-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Fix #152280: add Literal[…] PaddingMode to Conv modules #152590
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
base: main
Are you sure you want to change the base?
Fix #152280: add Literal[…] PaddingMode to Conv modules #152590
Conversation
* Defines PaddingMode alias * Annotates Conv{1,2,3}d constructors * Fixes pytorch#152280
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152590
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 5ccdcc5 with merge base 5236a85 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
The committers listed above are authorized under a signed CLA. |
@@ -79,7 +82,7 @@ def _conv_forward(self, input: Tensor, weight: Tensor, bias: Optional[Tensor]) - | |||
transposed: bool | |||
output_padding: tuple[int, ...] | |||
groups: int | |||
padding_mode: str | |||
padding_mode: PaddingMode |
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.
Maybe the abstract base classes can still have str and only the leaf classes need PaddingMode for backwards compatibility
@AnandVishesh1301 Please fix the remaining type errors |
@Skylion007 Sure, doing that now. Will create a PR soon. Thanks for the review! |
Description
Updates
padding_mode
type annotations in convolution modules to useLiteral
for improved type safety. This PR builds on #152458 by @sujeet4010, addressing unresolved MYPY errors intorch/ao/nn/qat/modules/conv.py
and adding test coverage.Related Issues
torch/nn/modules/conv.py
to use Literal for support padding modes #152280 (original issue)Changes Made
Literal
type to QAT modules.Credit to @sujeet4010 for the initial implementation.