From baa6273c541a6ab4af588fd9fb211c53323f3640 Mon Sep 17 00:00:00 2001 From: tangwei12 Date: Wed, 15 Aug 2018 19:21:03 +0800 Subject: [PATCH] unit test optimize --- .../paddle/fluid/tests/unittests/test_sampling_id_op.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_sampling_id_op.py b/python/paddle/fluid/tests/unittests/test_sampling_id_op.py index e3e7153049..708265b457 100644 --- a/python/paddle/fluid/tests/unittests/test_sampling_id_op.py +++ b/python/paddle/fluid/tests/unittests/test_sampling_id_op.py @@ -29,14 +29,19 @@ class TestSamplingIdOp(OpTest): self.inputs = {"X": self.X} self.Y = np.random.random(8).astype('float32') self.outputs = {'Out': self.Y} - self.attrs = {'use_mkldnn': self.use_mkldnn} + self.attrs = {'max': 1.0, 'min': 0.0, 'seed': 1} def test_check_output(self): self.check_output_customized(self.verify_output) + y1 = self.out + self.check_output_customized(self.verify_output) + y2 = self.out + self.assertTrue(np.array_equal(y1, y2)) + self.assertEqual(len(y1), len(self.Y)) def verify_output(self, outs): out = np.array(outs[0]) - self.assertEqual(len(out), len(self.Y)) + self.out = out def init_kernel_type(self): pass -- GitLab