-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in max_pool2d with ceil_mode under certain conditions #45357
Labels
high priority
module: nn
Related to torch.nn
module: pooling
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Milestone
Comments
A quick reading of the docs and napkin math suggests it should be |
gchanan
added
module: nn
Related to torch.nn
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
high priority
labels
Sep 28, 2020
@ngimel thinks the code is wrong, because a completely out of bounds window is not right |
confirmed this isn't a regression, so putting on the 1.8.0 milestone. |
1 task
1 task
heitorschueroff
added a commit
that referenced
this issue
Oct 20, 2020
This PR fixes a bug with how pooling output shape was computed. Previously, it did not consider the right padding as "part of the image" but the docs do. Now, in ceil mode it allows a kernel window to go off bounds as long as it starts within the image including both paddings. The boolean condition was also wrong, it should be ceil_mode. fixes #45357 [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 21, 2020
This PR fixes a bug with how pooling output shape was computed. Previously, it did not consider the right padding as "part of the image" but the docs do. Now, in ceil mode it allows a kernel window to go off bounds as long as it starts within the image including both paddings. The boolean condition was also wrong, it should be ceil_mode. fixes #45357 TODO - [ ] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 23, 2020
This PR fixes a bug with how pooling output shape was computed. ## BC Breaking Notes Previously, the pooling code allowed a kernel window to be entirely outside the input and it did not consider right padding as part of the input in the computations. Now, in ceil mode it allows a kernel window to go off bounds as long as it starts within the input including both paddings. If ceil_mode=False, then all kernel windows have to start inside the input, again including both paddings. fixes #45357 TODO - [ ] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 27, 2020
This PR fixes a bug with how pooling output shape was computed. ## BC Breaking Notes Previously, the pooling code allowed a kernel window to be entirely outside the input and it did not consider right padding as part of the input in the computations. Now, in ceil mode it allows a kernel window to go off bounds as long as it starts within the input including both paddings. If ceil_mode=False, then all kernel windows have to start inside the input, again including both paddings. fixes #45357 TODO - [x] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 27, 2020
This PR fixes a bug with how pooling output shape was computed. ## BC Breaking Notes Previously, the pooling code allowed a kernel window to be entirely outside the input and it did not consider right padding as part of the input in the computations. Now, in ceil mode it allows a kernel window to go off bounds as long as it starts within the input including both paddings. If ceil_mode=False, then all kernel windows have to start inside the input, again including both paddings. fixes #45357 TODO - [x] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 27, 2020
This PR fixes a bug with how pooling output shape was computed. ## BC Breaking Notes Previously, a bug in the pooling code allowed a sliding window to be entirely off bounds. Now, sliding windows must start inside the input or left padding (not right padding, see #46929) and may only go off-bounds if ceil_mode=True. fixes #45357 TODO - [x] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
heitorschueroff
added a commit
that referenced
this issue
Oct 29, 2020
This PR fixes a bug with how pooling output shape was computed. ## BC Breaking Notes Previously, a bug in the pooling code allowed a sliding window to be entirely off bounds. Now, sliding windows must start inside the input or left padding (not right padding, see #46929) and may only go off-bounds if ceil_mode=True. fixes #45357 TODO - [x] Ensure existing tests are checking for the correct output size [ghstack-poisoned]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
high priority
module: nn
Related to torch.nn
module: pooling
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃悰 Bug
In
torch.nn.functional.max_pool2d
withceil_mode=True
, there are cases where maximum can be taken for a fully out-of-bounds kernel. See repro.To Reproduce
Expected behavior
I would expect for these parameters (
kernel_size=1, stride=(2, 2), ceil_mode=True
), we would get an output of size (3, 4) since the 4th kernel on dimension 2 would start at index 6 which is out-of-bounds.cc @ezyang @gchanan @zou3519 @albanD @mruberry
The text was updated successfully, but these errors were encountered: