tf.reciprocal
和 tf.inv
似乎是等效的。有什么区别吗?它们被实现为单独的 TF 操作,并且还具有单独的梯度实现,这看起来也是等效的。
最佳答案
它们的意思是一样的。事实上,tf.inv
已重命名为 tf.reciprocal
和 tf.inv
在最新版本中不再暴露于顶级模块(尽管两者仍然存在于 gen_math_ops.py
中)。
Many functions have been renamed to match NumPy. This was done to make the transition between NumPy and TensorFlow as easy as possible. There are still numerous cases where functions do not match, so this is far from a hard and fast rule, but we have removed several commonly noticed inconsistencies.
tf.inv
- should be renamed to
tf.reciprocal
- This was done to avoid confusion with NumPy's matrix inverse
np.inv
您可以看到还有多个已重命名的函数,例如 tf.mul
和 tf.neg
。
关于python - `tf.reciprocal` 与 `tf.inv` : is there any difference?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48609466/