From 4e173527c1650ed86df714392e53801a498b0078 Mon Sep 17 00:00:00 2001 From: qijun Date: Wed, 13 Sep 2017 17:57:41 +0800 Subject: [PATCH] fix op python tests --- python/paddle/v2/framework/tests/test_exp_op.py | 4 ++-- python/paddle/v2/framework/tests/test_relu_op.py | 8 +++----- python/paddle/v2/framework/tests/test_sigmoid_op.py | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/python/paddle/v2/framework/tests/test_exp_op.py b/python/paddle/v2/framework/tests/test_exp_op.py index 5a004f6fe2f..0ec41e56a03 100644 --- a/python/paddle/v2/framework/tests/test_exp_op.py +++ b/python/paddle/v2/framework/tests/test_exp_op.py @@ -15,8 +15,8 @@ class TestExp(OpTest): self.check_output() 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() diff --git a/python/paddle/v2/framework/tests/test_relu_op.py b/python/paddle/v2/framework/tests/test_relu_op.py index 58a0872db41..c9af0c2ba7e 100644 --- a/python/paddle/v2/framework/tests/test_relu_op.py +++ b/python/paddle/v2/framework/tests/test_relu_op.py @@ -6,17 +6,15 @@ from op_test import OpTest class TestRelu(OpTest): def setUp(self): self.op_type = "relu" - self.inputs = { - 'X': np.random.uniform(-1, 1, [11, 17]).astype("float32") - } + self.inputs = {'X': np.random.uniform(-1, 1, [4, 4]).astype("float32")} self.outputs = {'Y': np.maximum(self.inputs['X'], 0)} def test_check_output(self): self.check_output() 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() diff --git a/python/paddle/v2/framework/tests/test_sigmoid_op.py b/python/paddle/v2/framework/tests/test_sigmoid_op.py index 2316e49eff7..cf05e934d5f 100644 --- a/python/paddle/v2/framework/tests/test_sigmoid_op.py +++ b/python/paddle/v2/framework/tests/test_sigmoid_op.py @@ -15,8 +15,8 @@ class TestSigmoid(OpTest): self.check_output() 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() -- GitLab