Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test_conv2d_op when compile without cuda #9698

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions python/paddle/fluid/tests/unittests/test_conv2d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ def setUp(self):
}
self.outputs = {'Output': output}

def testcudnn(self):
return core.is_compiled_with_cuda() and self.use_cudnn

def test_check_output(self):
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_output_with_place(place, atol=1e-5)
else:
Expand All @@ -107,7 +110,7 @@ def test_check_output(self):
def test_check_grad(self):
if self.dtype == np.float16:
return
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place,
Expand All @@ -121,7 +124,7 @@ def test_check_grad(self):
def test_check_grad_no_filter(self):
if self.dtype == np.float16:
return
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, ['Input'],
Expand All @@ -138,7 +141,7 @@ def test_check_grad_no_filter(self):
def test_check_grad_no_input(self):
if self.dtype == np.float16:
return
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, ['Filter'],
Expand Down