Skip to content

Commit baa6273

Browse files
committed
unit test optimize
1 parent 470fb7c commit baa6273

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,19 @@ def setUp(self):
2929
self.inputs = {"X": self.X}
3030
self.Y = np.random.random(8).astype('float32')
3131
self.outputs = {'Out': self.Y}
32-
self.attrs = {'use_mkldnn': self.use_mkldnn}
32+
self.attrs = {'max': 1.0, 'min': 0.0, 'seed': 1}
3333

3434
def test_check_output(self):
3535
self.check_output_customized(self.verify_output)
36+
y1 = self.out
37+
self.check_output_customized(self.verify_output)
38+
y2 = self.out
39+
self.assertTrue(np.array_equal(y1, y2))
40+
self.assertEqual(len(y1), len(self.Y))
3641

3742
def verify_output(self, outs):
3843
out = np.array(outs[0])
39-
self.assertEqual(len(out), len(self.Y))
44+
self.out = out
4045

4146
def init_kernel_type(self):
4247
pass

0 commit comments

Comments
 (0)