未验证 提交 68d5c12b 编写于 作者: S Shang Zhizhou 提交者: GitHub

fix unittest (#43609) (#43617)

上级 a5ccc713
......@@ -160,7 +160,7 @@ class TestParameter(object):
exe = fluid.Executor(place)
result, = exe.run(feed={"X": np_x}, fetch_list=[out])
expected = eval("np.%s(np_x)" % self.op_type)
self.assertEqual(result, expected)
self.assertTrue(np.allclose(result, expected))
def test_dygraph(self):
with fluid.dygraph.guard():
......@@ -168,11 +168,7 @@ class TestParameter(object):
x = fluid.dygraph.to_variable(np_x)
z = eval("paddle.%s(x).numpy()" % self.op_type)
z_expected = eval("np.%s(np_x)" % self.op_type)
# ROCM platform will fail in assertEqual
if core.is_compiled_with_rocm():
self.assertTrue(np.allclose(z, z_expected))
else:
self.assertEqual(z, z_expected)
self.assertTrue(np.allclose(z, z_expected))
class TestSigmoid(TestActivation):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册