提交 baa6273c 编写于 作者: T tangwei12

unit test optimize

上级 470fb7c5
...@@ -29,14 +29,19 @@ class TestSamplingIdOp(OpTest): ...@@ -29,14 +29,19 @@ class TestSamplingIdOp(OpTest):
self.inputs = {"X": self.X} self.inputs = {"X": self.X}
self.Y = np.random.random(8).astype('float32') self.Y = np.random.random(8).astype('float32')
self.outputs = {'Out': self.Y} 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): def test_check_output(self):
self.check_output_customized(self.verify_output) 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): def verify_output(self, outs):
out = np.array(outs[0]) out = np.array(outs[0])
self.assertEqual(len(out), len(self.Y)) self.out = out
def init_kernel_type(self): def init_kernel_type(self):
pass pass
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册