From 14f223624f2729ed7fd5140aae238915ec38043c Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Sun, 19 May 2019 16:51:39 +0800 Subject: [PATCH] fix sqrt unittest. test=develop (#17440) --- python/paddle/fluid/tests/unittests/test_nn_grad.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_nn_grad.py b/python/paddle/fluid/tests/unittests/test_nn_grad.py index b8c9d73e4f3..8dd1d294230 100644 --- a/python/paddle/fluid/tests/unittests/test_nn_grad.py +++ b/python/paddle/fluid/tests/unittests/test_nn_grad.py @@ -96,8 +96,8 @@ class TestLeakyReluDoubleGradCheck(unittest.TestCase): class TestSqrtDoubleGradCheck(unittest.TestCase): @prog_scope() def func(self, place): - shape = [7, 9] - eps = 0.005 + shape = [3, 7] + eps = 0.0001 dtype = np.float64 x = layers.data('x', shape, False, dtype) @@ -107,9 +107,9 @@ class TestSqrtDoubleGradCheck(unittest.TestCase): x_arr = np.random.uniform(0.1, 1, shape).astype(dtype) gradient_checker.double_grad_check( - [x], y, x_init=x_arr, place=place, eps=eps, rtol=1e-2, atol=1e-2) + [x], y, x_init=x_arr, place=place, eps=eps) - def no_test_grad(self): + def test_grad(self): places = [fluid.CPUPlace()] if core.is_compiled_with_cuda(): places = [fluid.CUDAPlace(0)] -- GitLab