Skip to content

Fix max_pool2d for returning wrong shape with return_indices=True on cuda #38992

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

Closed
wants to merge 5 commits into from

Conversation

xwang233
Copy link
Collaborator

Fix #38986

The current code only resizes pooling output but forget to resize indices as well.

@xwang233 xwang233 requested a review from ezyang May 25, 2020 20:24
@xwang233 xwang233 changed the title Fix max_pool2d returns wrong shape with return_indices=True on cuda Fix max_pool2d for returning wrong shape with return_indices=True on cuda May 25, 2020
@dr-ci
Copy link

dr-ci bot commented May 25, 2020

💊 CI failures summary and remediations

As of commit e32253d (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 7 times.

test/test_nn.py Outdated
def test_max_pool2d_indices(self, device):
def helper(n, c, h, w, ks):
if h is None:
x = torch.randn(n, c, w, device='cuda', dtype=torch.float, requires_grad=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test (while correct) is confusing - 3d input is chw, not ncw (that it, it lacks batch dimension, not one of the spatial dimensions).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, seems like I confused that with the unsqueeze(2) in max_pool1d. Will fix. Thanks!

Copy link
Collaborator

@ngimel ngimel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally looks good, but please fix variables in the test.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ngimel has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ngimel merged this pull request in 583ff94.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong shape of F.max_pool2d(..., return_indices=True) on CUDA
6 participants