-
Couldn't load subscription status.
- Fork 74.9k
Open
Labels
TF 2.9Issues found in the TF 2.9 release (or RCs)Issues found in the TF 2.9 release (or RCs)comp:opsOPs related issuesOPs related issuestype:bugBugBug
Description
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
binary
TensorFlow version
2.9
Custom code
Yes
OS platform and distribution
Linux Debian 11
Mobile device
No response
Python version
3.9
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
Result of tf.ones([10], dtype=tf.float32)/tf.ones([10], dtype=tf.float32) should be all 1.0, but was [0.99999994 0.99999994 0.99999994 0.99999994 0.99999994 0.99999994 0.99999994 0.99999994 1. 1. ] in graph mode.
Tensorflow versions before 2.9 don't have this problem, starting from 2.9 this problem ocurrs whether I enable or disable oneDNN.
Regarding CPU, this problem occurs on Intel 8336C, AMD 9Y24, but not on Apple M4.
Also, using Eigen's cwiseQuotient gives accurate result, whether avx2 or avx512f is used.
Standalone code to reproduce the issue
import os
os.environ["TF_ENABLE_ONEDNN_OPTS"] = "0"
import tensorflow as tf
@tf.function
def reverse(x):
return 1.0 / x
ones = tf.ones([10], dtype=tf.float32)
print("graph:", reverse(ones))
tf.config.run_functions_eagerly(True)
print("eager:", reverse(ones))
print("version:", tf.version.GIT_VERSION, tf.version.VERSION)Relevant log output
graph: tf.Tensor(
[0.99999994 0.99999994 0.99999994 0.99999994 0.99999994 0.99999994
0.99999994 0.99999994 1. 1. ], shape=(10,), dtype=float32)
eager: tf.Tensor([1. 1. 1. 1. 1. 1. 1. 1. 1. 1.], shape=(10,), dtype=float32)
version: v1.12.1-132116-gf67cb87691d 2.21.0-dev20251017Metadata
Metadata
Assignees
Labels
TF 2.9Issues found in the TF 2.9 release (or RCs)Issues found in the TF 2.9 release (or RCs)comp:opsOPs related issuesOPs related issuestype:bugBugBug