From c2a437fd0f0973f530b1b358c7a09389fcc34cbc Mon Sep 17 00:00:00 2001 From: Sylwester Fraczek Date: Fri, 10 Aug 2018 12:21:26 +0200 Subject: [PATCH] review fixes --- .../fluid/tests/unittests/test_conv2d_op.py | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_conv2d_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_op.py index f073036d3..bb1cd87d6 100644 --- a/python/paddle/fluid/tests/unittests/test_conv2d_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_op.py @@ -103,37 +103,20 @@ class TestConv2dOp(OpTest): return core.is_compiled_with_cuda() and self.use_cudnn def test_check_output(self): - if self.testcudnn(): - place = core.CUDAPlace(0) - self.check_output_with_place(place, atol=1e-5) - place = core.CPUPlace() + place = core.CUDAPlace(0) if self.testcudnn() else core.CPUPlace() self.check_output_with_place(place, atol=1e-5) def test_check_grad(self): if self.dtype == np.float16: return - if self.testcudnn(): - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, - set(['Input', 'Filter']), - 'Output', - max_relative_error=0.02) - place = core.CPUPlace() + place = core.CUDAPlace(0) if self.testcudnn() else core.CPUPlace() self.check_grad_with_place( place, set(['Input', 'Filter']), 'Output', max_relative_error=0.02) def test_check_grad_no_filter(self): if self.dtype == np.float16: return - if self.testcudnn(): - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, ['Input'], - 'Output', - max_relative_error=0.02, - no_grad_set=set(['Filter'])) - place = core.CPUPlace() + place = core.CUDAPlace(0) if self.testcudnn() else core.CPUPlace() self.check_grad_with_place( place, ['Input'], 'Output', @@ -143,14 +126,7 @@ class TestConv2dOp(OpTest): def test_check_grad_no_input(self): if self.dtype == np.float16: return - if self.testcudnn(): - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, ['Filter'], - 'Output', - max_relative_error=0.02, - no_grad_set=set(['Input'])) - place = core.CPUPlace() + place = core.CUDAPlace(0) if self.testcudnn() else core.CPUPlace() self.check_grad_with_place( place, ['Filter'], 'Output', -- GitLab