未验证 提交 14f22362 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix sqrt unittest. test=develop (#17440)

上级 977e9fcb
...@@ -96,8 +96,8 @@ class TestLeakyReluDoubleGradCheck(unittest.TestCase): ...@@ -96,8 +96,8 @@ class TestLeakyReluDoubleGradCheck(unittest.TestCase):
class TestSqrtDoubleGradCheck(unittest.TestCase): class TestSqrtDoubleGradCheck(unittest.TestCase):
@prog_scope() @prog_scope()
def func(self, place): def func(self, place):
shape = [7, 9] shape = [3, 7]
eps = 0.005 eps = 0.0001
dtype = np.float64 dtype = np.float64
x = layers.data('x', shape, False, dtype) x = layers.data('x', shape, False, dtype)
...@@ -107,9 +107,9 @@ class TestSqrtDoubleGradCheck(unittest.TestCase): ...@@ -107,9 +107,9 @@ class TestSqrtDoubleGradCheck(unittest.TestCase):
x_arr = np.random.uniform(0.1, 1, shape).astype(dtype) x_arr = np.random.uniform(0.1, 1, shape).astype(dtype)
gradient_checker.double_grad_check( 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()] places = [fluid.CPUPlace()]
if core.is_compiled_with_cuda(): if core.is_compiled_with_cuda():
places = [fluid.CUDAPlace(0)] places = [fluid.CUDAPlace(0)]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册