From 6ef4f1f8c07df697d698dd049a7373aa25552ddf Mon Sep 17 00:00:00 2001 From: Kexin Zhao Date: Thu, 15 Mar 2018 20:51:58 -0700 Subject: [PATCH] small fix --- python/paddle/fluid/tests/unittests/test_cast_op.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_cast_op.py b/python/paddle/fluid/tests/unittests/test_cast_op.py index 9c6ab00c85f..b8d3ed3aa3e 100644 --- a/python/paddle/fluid/tests/unittests/test_cast_op.py +++ b/python/paddle/fluid/tests/unittests/test_cast_op.py @@ -40,7 +40,7 @@ class TestCastOp2(op_test.OpTest): def setUp(self): ipt = np.random.random(size=[10, 10]) # numpy float16 is binded to fluid float16 via uint16 - self.inputs = {'X': ipt.astype('float16').view(uint16)} + self.inputs = {'X': ipt.astype('float16').view(np.uint16)} self.outputs = {'Out': ipt.astype('float32')} self.attrs = { 'in_dtype': int(core.VarDesc.VarType.FP16), @@ -49,10 +49,10 @@ class TestCastOp2(op_test.OpTest): self.op_type = 'cast' def test_check_output(self): - self.check_output() + self.check_output(atol=1e-3) -class TestCastOp2(op_test.OpTest): +class TestCastOp3(op_test.OpTest): def setUp(self): ipt = np.random.random(size=[10, 10]) self.inputs = {'X': ipt.astype('float32')} @@ -64,7 +64,7 @@ class TestCastOp2(op_test.OpTest): self.op_type = 'cast' def test_check_output(self): - self.check_output() + self.check_output(atol=1e-3) if __name__ == '__main__': -- GitLab