-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add error checking for padding modules #106147
Add error checking for padding modules #106147
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/106147
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c2c0b23: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Fixes #105627 [ghstack-poisoned]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
Testing?
Fixes #105627 [ghstack-poisoned]
Fixes #105627 [ghstack-poisoned]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test!
Fixes #105627 [ghstack-poisoned]
# Constant Pad 1D with single dimension input | ||
helper((16), (1, 2), nn.ConstantPad1d) | ||
# Constant Pad with single dimension input | ||
helper_functional((16), (1, 2), 'constant') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nn.functional.pad
allows constant padding for arbitrary dimensions, which is different from the other modes replicate, reflect and circular (see docs), however, nn.ConstantPad{1,2,3}d
only allow 2/3D, 3/4D and 4/5D inputs respectively based on the docs (e.g. here for 1D). Changing the cases where input shapes are invalid according the docs to test the functional variant here
…06148) Fixes #105749 #95320 (tldr is that input should always be `[N, C, H, (W, D])` where only H, W and D dimensions get circular padding, so the 2D case where user wants both dimensions to be padded --> they should `.unsqueeze(0)` (as is the case for `Reflection/ReplicationPad`) but we didn't document this for circular padding. [This seems to be the old docstring](https://github.com/pytorch/pytorch/blob/277b05014aced075337d6f84a535bd5150aabebb/torch/nn/functional.py#L4689) that was somehow lost. Fixes no_batch_dim support #104860 - Adds missing documentation for circular padding - Adds missing CircularPad modules - Migrates legacy test_nn tests from circular padding to ModuleInfo - Adds no_batch_dim support + sample inputs that test this Pull Request resolved: #106148 Approved by: https://github.com/albanD ghstack dependencies: #106325, #106147
@pytorchbot revert -m "sadly it is breaking internal builds, and I can't coordinate a FF due to timezone differences" -c nosignal |
@pytorchbot successfully started a revert job. Check the current status here. |
Reverting PR 106147 failedReason: Comment with id 1661870454 not found Details for Dev Infra teamRaised by workflow job |
@pytorchbot revert -m "sadly it is breaking internal builds, and I can't coordinate a FF due to timezone differences" -c nosignal |
@pytorchbot successfully started a revert job. Check the current status here. |
@mikaylagawarecki your PR has been successfully reverted. |
This reverts commit 0547b62. Reverted #106147 on behalf of https://github.com/jeanschmidt due to sadly it is breaking internal builds, and I can't coordinate a FF due to timezone differences ([comment](#106147 (comment)))
@pytorchbot successfully started a revert job. Check the current status here. |
@mikaylagawarecki your PR has been successfully reverted. |
@jeanschmidt |
…port (#106148)" This reverts commit 87d2536. Reverted #106148 on behalf of https://github.com/malfet due to Reverting as dependent PR #106147 was reverted as well ([comment](#106148 (comment)))
…tch_dim support (#106148)"" Previous one was reverted because the PR stacked under which added error-checking to Pad variants #106147 was reverted as internally some people pass 2D inputs to ZeroPad2d (which should actually take 3d or 4d inputs :) but there wasn't actually anything this PR was breaking according to my understanding [ghstack-poisoned]
…port (#106148)" (#106632) Previous one was reverted because the PR stacked under which added error-checking to Pad variants #106147 was reverted as internally some people pass 2D inputs to ZeroPad2d (which should actually take 3d or 4d inputs :) but there wasn't actually anything this PR was breaking according to my understanding Pull Request resolved: #106632 Approved by: https://github.com/albanD
…port (pytorch#106148)" (pytorch#106632) Previous one was reverted because the PR stacked under which added error-checking to Pad variants pytorch#106147 was reverted as internally some people pass 2D inputs to ZeroPad2d (which should actually take 3d or 4d inputs :) but there wasn't actually anything this PR was breaking according to my understanding Pull Request resolved: pytorch#106632 Approved by: https://github.com/albanD
Fixes #105627
Stack from ghstack (oldest at bottom):