File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
python/paddle/fluid/tests/unittests Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,11 @@ def setUp(self):
97
97
}
98
98
self .outputs = {'Output' : output }
99
99
100
+ def testcudnn (self ):
101
+ return core .is_compiled_with_cuda () and self .use_cudnn
102
+
100
103
def test_check_output (self ):
101
- if self .use_cudnn :
104
+ if self .testcudnn () :
102
105
place = core .CUDAPlace (0 )
103
106
self .check_output_with_place (place , atol = 1e-5 )
104
107
else :
@@ -107,7 +110,7 @@ def test_check_output(self):
107
110
def test_check_grad (self ):
108
111
if self .dtype == np .float16 :
109
112
return
110
- if self .use_cudnn :
113
+ if self .testcudnn () :
111
114
place = core .CUDAPlace (0 )
112
115
self .check_grad_with_place (
113
116
place ,
@@ -121,7 +124,7 @@ def test_check_grad(self):
121
124
def test_check_grad_no_filter (self ):
122
125
if self .dtype == np .float16 :
123
126
return
124
- if self .use_cudnn :
127
+ if self .testcudnn () :
125
128
place = core .CUDAPlace (0 )
126
129
self .check_grad_with_place (
127
130
place , ['Input' ],
@@ -138,7 +141,7 @@ def test_check_grad_no_filter(self):
138
141
def test_check_grad_no_input (self ):
139
142
if self .dtype == np .float16 :
140
143
return
141
- if self .use_cudnn :
144
+ if self .testcudnn () :
142
145
place = core .CUDAPlace (0 )
143
146
self .check_grad_with_place (
144
147
place , ['Filter' ],
You can’t perform that action at this time.
0 commit comments