diff --git a/python/paddle/fluid/tests/unittests/test_activation_op.py b/python/paddle/fluid/tests/unittests/test_activation_op.py index 7dde0483823be325d95d4d237937562d339408a7..dd242920db3168fb6d2fba0f948270f50b04cb5e 100755 --- a/python/paddle/fluid/tests/unittests/test_activation_op.py +++ b/python/paddle/fluid/tests/unittests/test_activation_op.py @@ -168,7 +168,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(): @@ -176,11 +176,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):