tensorflow 使用`jit_compile=True`时,`tf.raw_ops.Acos`的行为不同,

j5fpnvbx  于 22天前  发布在  其他
关注(0)|答案(4)|浏览(19)

问题类型

Bug

你是否在TensorFlow Nightly版本中复现了这个bug?

问题来源

source

TensorFlow版本

2.14.0

自定义代码

OS平台和发行版

Ubuntu 22.04.3 LTS (x86_64)

移动设备

无响应

Python版本

无响应

Bazel版本

无响应

GCC/编译器版本

无响应

CUDA/cuDNN版本

11.8

GPU型号和内存

GPU 0: NVIDIA GeForce RTX 2070 GPU 1: NVIDIA GeForce RTX 2070 GPU 2: NVIDIA GeForce RTX 2070 GPU 3: NVIDIA GeForce RTX 2070

当前行为?

tf.raw_ops.Acos操作在一个启用了JIT编译的tf.function中被调用(jit_compile=True),它产生的结果与没有启用JIT编译时调用相同的操作产生不同的结果。这种不一致性在GPU设备上执行代码时观察到。

重现问题的独立代码

I can reproduce this issue on colab: https://colab.research.google.com/drive/1SJWDSLO8pIIVYfZYv1M8gFaUiOyX--MI?usp=sharing

相关日志输出

File "/home/guihuan/LLM/results/tf-2/2023-10-22-20-21/test.py", line 50, in <module>
    tf.debugging.assert_near(no_op_res, op_res, atol=0.001, rtol=0.001)
  File "/home/guihuan/.conda/envs/night/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/guihuan/.conda/envs/night/lib/python3.9/site-packages/tensorflow/python/ops/control_flow_assert.py", line 102, in Assert
    raise errors.InvalidArgumentError(
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected 'tf.Tensor(False, shape=(), dtype=bool)' to be true. Summarized data: b''
b'x and y not equal to tolerance rtol = tf.Tensor(0.001, shape=(), dtype=float32), atol = tf.Tensor(0.001, shape=(), dtype=float32)'
b'x (shape=(10, 9) dtype=complex64) = '
(2.0430856-14.103499j), (2.0611959+14.493816j), (2.392881+13.213637j), ...
b'y (shape=(10, 9) dtype=complex64) = '
(2.0430856-14.103499j), 3.465736j, 4.158883j, ...
jgovgodb

jgovgodb1#

你好 @zoux1a ,
我已经复制了报告中描述的行为,并在 jit_compile=True 和 jit_compile = False 的情况下进行了测试。它在 jit_compile=False 下可以正常工作。我为您附上了 gist 作为参考。
谢谢!

tmb3ates

tmb3ates2#

这个bug似乎与Acos有关?至少复现器是针对Acos的。

dddzy1tm

dddzy1tm3#

你好,@zoux1a 和 @akuegel
使用 jit_compile 和不使用 jit_compile 的结果似乎相差超过100%,甚至随着输入值的增加而增加,例如计算 [(res_xla-res_eager)/res_xla]。对我来说,这种差异似乎很大,因为它不仅仅是精度差异。
我已将我的练习相关的代码片段附上。

xcitsw88

xcitsw884#

请将标题和错误描述调整为Acos而不是Asin?我在这里看到的复现者都是针对Acos的,所以这似乎是这个bug的问题所在?

相关问题