Skip to content

Commit 6ef4f1f

Browse files
committed
small fix
1 parent f3c5e81 commit 6ef4f1f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/paddle/fluid/tests/unittests/test_cast_op.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TestCastOp2(op_test.OpTest):
4040
def setUp(self):
4141
ipt = np.random.random(size=[10, 10])
4242
# numpy float16 is binded to fluid float16 via uint16
43-
self.inputs = {'X': ipt.astype('float16').view(uint16)}
43+
self.inputs = {'X': ipt.astype('float16').view(np.uint16)}
4444
self.outputs = {'Out': ipt.astype('float32')}
4545
self.attrs = {
4646
'in_dtype': int(core.VarDesc.VarType.FP16),
@@ -49,10 +49,10 @@ def setUp(self):
4949
self.op_type = 'cast'
5050

5151
def test_check_output(self):
52-
self.check_output()
52+
self.check_output(atol=1e-3)
5353

5454

55-
class TestCastOp2(op_test.OpTest):
55+
class TestCastOp3(op_test.OpTest):
5656
def setUp(self):
5757
ipt = np.random.random(size=[10, 10])
5858
self.inputs = {'X': ipt.astype('float32')}
@@ -64,7 +64,7 @@ def setUp(self):
6464
self.op_type = 'cast'
6565

6666
def test_check_output(self):
67-
self.check_output()
67+
self.check_output(atol=1e-3)
6868

6969

7070
if __name__ == '__main__':

0 commit comments

Comments
 (0)