You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tf.experimental.numpy.rad2deg fails on integer arrays and Python lists #129238
Unlike deg2rad, rad2deg does not convert its input or promote it to float. It just returns x * (180.0 / np.pi) (np_math_ops.py#L1000-L1001). So:
tnp.rad2deg([1.0, 2.0]) raises TypeError: can't multiply sequence by non-int of type 'float'
tnp.rad2deg(tnp.array(1)) raises TypeError: Cannot convert 57.29... to EagerTensor of dtype int64
tnp.rad2deg(np.array([1.0])) returns a numpy.ndarray, not a TF tensor
deg2rad handles all three correctly because it goes through _scalar(f, x, promote_to_float=True). rad2deg should do the same.
Standalone code to reproduce the issue
importnumpyasnpimporttensorflow.experimental.numpyastnpprint(tnp.deg2rad(180)) # worksprint(type(tnp.rad2deg(np.array([1.0])))) # numpy.ndarray, not a TF tensortry:
print(tnp.rad2deg([1.0, 2.0]))
exceptExceptionase:
print(type(e).__name__, e) # TypeError: can't multiply sequence by non-int of type 'float'try:
print(tnp.rad2deg(tnp.array(1)))
exceptExceptionase:
print(type(e).__name__, e) # TypeError: Cannot convert 57.29... to EagerTensor of dtype int64
Relevant log output
tf.Tensor(3.141592653589793, shape=(), dtype=float64)
<class 'numpy.ndarray'>
TypeError can't multiply sequence by non-int of type 'float'TypeError Cannot convert 57.29577951308232 to EagerTensor of dtype int64
Hi @bodapatisaikrishna,
Thanks for reporting the issue and submitting a fix for TensorFlow. Once the PR is merged, the issue will be resolved. We truly appreciate your initiative and the effort in contributing the fix.
Activity
Kayyuri commentedon Oct 19, 2026
Hi @bodapatisaikrishna,
Thanks for reporting the issue and submitting a fix for TensorFlow. Once the PR is merged, the issue will be resolved. We truly appreciate your initiative and the effort in contributing the fix.
Fix several NumPy mismatches in tf.experimental.numpy
google-ml-butler commentedon Oct 23, 2026
Are you satisfied with the resolution of your issue?
Yes
No