提交 4e173527 编写于 作者: Q qijun

fix op python tests

上级 b50a5076
...@@ -15,8 +15,8 @@ class TestExp(OpTest): ...@@ -15,8 +15,8 @@ class TestExp(OpTest):
self.check_output() self.check_output()
def test_check_grad(self): def test_check_grad(self):
self.check_grad(["X"], "Y", max_relative_error=0.007) self.check_grad(['X'], 'Y', max_relative_error=0.007)
if __name__ == '__main__': if __name__ == "__main__":
unittest.main() unittest.main()
...@@ -6,17 +6,15 @@ from op_test import OpTest ...@@ -6,17 +6,15 @@ from op_test import OpTest
class TestRelu(OpTest): class TestRelu(OpTest):
def setUp(self): def setUp(self):
self.op_type = "relu" self.op_type = "relu"
self.inputs = { self.inputs = {'X': np.random.uniform(-1, 1, [4, 4]).astype("float32")}
'X': np.random.uniform(-1, 1, [11, 17]).astype("float32")
}
self.outputs = {'Y': np.maximum(self.inputs['X'], 0)} self.outputs = {'Y': np.maximum(self.inputs['X'], 0)}
def test_check_output(self): def test_check_output(self):
self.check_output() self.check_output()
def test_check_grad(self): def test_check_grad(self):
self.check_grad(["X"], "Y", max_relative_error=0.007) self.check_grad(['X'], 'Y', max_relative_error=0.007)
if __name__ == '__main__': if __name__ == "__main__":
unittest.main() unittest.main()
...@@ -15,8 +15,8 @@ class TestSigmoid(OpTest): ...@@ -15,8 +15,8 @@ class TestSigmoid(OpTest):
self.check_output() self.check_output()
def test_check_grad(self): def test_check_grad(self):
self.check_grad(["X"], "Y", max_relative_error=0.007) self.check_grad(['X'], 'Y', max_relative_error=0.007)
if __name__ == '__main__': if __name__ == "__main__":
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册