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
3 changes: 3 additions & 0 deletions python/paddle/fluid/layers/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9260,6 +9260,9 @@ def affine_grid(theta, out_shape, name=None):
'affine_grid')
else:
attrs['output_shape'] = out_shape
if core.is_compiled_with_rocm():
# ROCM platform do not have MIOPEN kernel for affine_grid
attrs['use_cudnn'] = False

helper.append_op(
type='affine_grid',
Expand Down
2 changes: 2 additions & 0 deletions python/paddle/fluid/tests/unittests/test_affine_grid_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def initTestCase(self):
self.output_shape = np.array([20, 2, 5, 7]).astype("int32")
self.dynamic_shape = True
self.use_cudnn = True
if paddle.fluid.core.is_compiled_with_rocm():
self.use_cudnn = False # ROCM platform do not have MIOPEN kernel for affine_grid
self.align_corners = True


Expand Down
2 changes: 2 additions & 0 deletions python/paddle/nn/functional/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def affine_grid(theta, out_shape, align_corners=True, name=None):
use_cudnn = True
else:
use_cudnn = False
if core.is_compiled_with_rocm():
use_cudnn = False # ROCM platform do not have MIOPEN kernel for affine_grid

if not (isinstance(out_shape, list) or isinstance(out_shape, tuple) or \
isinstance(out_shape, Variable)):
Expand Down