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 of affine_grid with rocm #32047

Merged
merged 2 commits into from
Apr 6, 2021
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