未验证 提交 b0a64800 编写于 作者: H Huihuang Zheng 提交者: GitHub

Hotfix Release 2.3 Bug for CUDA 11.2 (#42437)

This PR hotfixed the `test_cond.py` in CUDA 11.2

The reason of the bug is that the `fill_constant` op returns wrong value in the modified test case `test_extremely_simple_net_with_op_in_condition`, SWEs can use `layers.Print(a)` and `layers.Print(b)` in the test case to reproduce it and they can see the `fill_constant` returns something `e-50` instead of `1.23` and `1.25`

This PR hotfixed the bug by comparing `b` value instead of actual number, which makes sure the `cond` logic is right. **However, the PR didn't fix `fill_constant`**. We would let the SWEs who are working here to find the op bug and fix it.
上级 fb3d5f07
......@@ -235,12 +235,13 @@ class TestCondInputOutput(unittest.TestCase):
place = fluid.CUDAPlace(0) if core.is_compiled_with_cuda(
) else fluid.CPUPlace()
exe = fluid.Executor(place)
ret = exe.run(main_program, fetch_list=[out, a.grad_name, b.grad_name])
ret = exe.run(main_program,
fetch_list=[out, b, a.grad_name, b.grad_name])
# Note: fill_constant has loss of precision, you have to assertEqual
# with values doens't lose precision in float-point number.
self.assertEqual(ret[0][0], 1.25)
self.assertEqual(ret[1][0], 0.0)
self.assertEqual(ret[2][0], 1.0)
self.assertEqual(ret[0][0], ret[1][0])
self.assertEqual(ret[2][0], 0.0)
self.assertEqual(ret[3][0], 1.0)
class TestCondNestedControlFlow(unittest.TestCase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册