提交 dcbc4284 编写于 作者: S Sylwester Fraczek

conv2d tests: stop testing on CUDA when use_cudnn=False. Especially when use_mkldnn=True.

上级 d74bb6ab
...@@ -106,8 +106,8 @@ class TestConv2dOp(OpTest): ...@@ -106,8 +106,8 @@ class TestConv2dOp(OpTest):
if self.testcudnn(): if self.testcudnn():
place = core.CUDAPlace(0) place = core.CUDAPlace(0)
self.check_output_with_place(place, atol=1e-5) self.check_output_with_place(place, atol=1e-5)
else: place = core.CPUPlace()
self.check_output() self.check_output_with_place(place, atol=1e-5)
def test_check_grad(self): def test_check_grad(self):
if self.dtype == np.float16: if self.dtype == np.float16:
...@@ -119,9 +119,9 @@ class TestConv2dOp(OpTest): ...@@ -119,9 +119,9 @@ class TestConv2dOp(OpTest):
set(['Input', 'Filter']), set(['Input', 'Filter']),
'Output', 'Output',
max_relative_error=0.02) max_relative_error=0.02)
else: place = core.CPUPlace()
self.check_grad( self.check_grad_with_place(
set(['Input', 'Filter']), 'Output', max_relative_error=0.02) place, set(['Input', 'Filter']), 'Output', max_relative_error=0.02)
def test_check_grad_no_filter(self): def test_check_grad_no_filter(self):
if self.dtype == np.float16: if self.dtype == np.float16:
...@@ -133,12 +133,12 @@ class TestConv2dOp(OpTest): ...@@ -133,12 +133,12 @@ class TestConv2dOp(OpTest):
'Output', 'Output',
max_relative_error=0.02, max_relative_error=0.02,
no_grad_set=set(['Filter'])) no_grad_set=set(['Filter']))
else: place = core.CPUPlace()
self.check_grad( self.check_grad_with_place(
['Input'], place, ['Input'],
'Output', 'Output',
max_relative_error=0.02, max_relative_error=0.02,
no_grad_set=set(['Filter'])) no_grad_set=set(['Filter']))
def test_check_grad_no_input(self): def test_check_grad_no_input(self):
if self.dtype == np.float16: if self.dtype == np.float16:
...@@ -150,12 +150,12 @@ class TestConv2dOp(OpTest): ...@@ -150,12 +150,12 @@ class TestConv2dOp(OpTest):
'Output', 'Output',
max_relative_error=0.02, max_relative_error=0.02,
no_grad_set=set(['Input'])) no_grad_set=set(['Input']))
else: place = core.CPUPlace()
self.check_grad( self.check_grad_with_place(
['Filter'], place, ['Filter'],
'Output', 'Output',
max_relative_error=0.02, max_relative_error=0.02,
no_grad_set=set(['Input'])) no_grad_set=set(['Input']))
def init_test_case(self): def init_test_case(self):
self.pad = [0, 0] self.pad = [0, 0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册