tf.reciprocal
and tf.inv
seem to be equivalent. Is there any difference? They are implemented as separate TF ops and also have separate gradient implementations, which also seem equivalent.
Asked
Active
Viewed 834 times
2
1 Answers
2
They mean the same. In fact, tf.inv
was renamed to tf.reciprocal
and tf.inv
is no longer exposed to the top level module in the latest versions (though both still exist in gen_math_ops.py
).
From the migration documentation:
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
You can see there several more functions that were renamed, like tf.mul
and tf.neg
.

Maxim
- 52,561
- 27
- 155
- 209