Skip to content
Merged
Show file tree
Hide file tree
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_conv3d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,18 @@ 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:
self.check_output()

def test_check_grad(self):
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place,
Expand All @@ -117,7 +120,7 @@ def test_check_grad(self):
set(['Input', 'Filter']), 'Output', max_relative_error=0.03)

def test_check_grad_no_filter(self):
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, ['Input'],
Expand All @@ -132,7 +135,7 @@ def test_check_grad_no_filter(self):
no_grad_set=set(['Filter']))

def test_check_grad_no_input(self):
if self.use_cudnn:
if self.testcudnn():
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, ['Filter'],
Expand Down
7 changes: 5 additions & 2 deletions python/paddle/fluid/tests/unittests/test_pool2d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ def setUp(self):

self.outputs = {'Out': 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 @@ -119,7 +122,7 @@ def test_check_output(self):
def test_check_grad(self):
if self.dtype == np.float16:
return
if self.use_cudnn and self.pool_type != "max":
if self.testcudnn() and self.pool_type != "max":
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, set(['X']), 'Out', max_relative_error=0.07)
Expand Down
7 changes: 5 additions & 2 deletions python/paddle/fluid/tests/unittests/test_pool3d_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ def setUp(self):

self.outputs = {'Out': output.astype('float32')}

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:
self.check_output()

def test_check_grad(self):
if self.use_cudnn and self.pool_type != "max":
if self.testcudnn() and self.pool_type != "max":
place = core.CUDAPlace(0)
self.check_grad_with_place(
place, set(['X']), 'Out', max_relative_error=0.07)
Expand Down