From fff6f595ff502d71c29dd1b5824f1d2940cd6069 Mon Sep 17 00:00:00 2001 From: tangwei12 Date: Fri, 24 Aug 2018 12:31:29 +0800 Subject: [PATCH] add unit test --- .../paddle/fluid/tests/unittests/test_fill_constant_op.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_fill_constant_op.py b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py index b73711b19d6..537cabd5d09 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_constant_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py @@ -62,8 +62,10 @@ class TestFillConstantOpWithSelectedRows(OpTest): fill_constant_op.run(scope, place) # get result from Out - result_array = np.array(out) - self.assertEqual(result_array, np.full((123, 92), 3.8)) + result_array = np.array(out.get_tensor()) + full_array = np.full((123, 92), 3.8, 'float32') + + self.assertTrue(np.array_equal(result_array, full_array)) def test_fill_constant_with_selected_rows(self): places = [core.CPUPlace()] -- GitLab