8000 Fix #152280: add Literal[…] PaddingMode to Conv modules by AnandVishesh1301 · Pull Request #152590 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AnandVishesh1301
Copy link

Description

Updates padding_mode type annotations in convolution modules to use Literal for improved type safety. This PR builds on #152458 by @sujeet4010, addressing unresolved MYPY errors in torch/ao/nn/qat/modules/conv.py and adding test coverage.

Related Issues

Changes Made

  • Extended Literal type to QAT modules.
  • Added tests validating type enforcem 8000 ent.
  • Addressed CI failures from previous attempt.

Credit to @sujeet4010 for the initial implementation.

* Defines PaddingMode alias
* Annotates Conv{1,2,3}d constructors
* Fixes pytorch#152280
Copy link
pytorch-bot bot commented May 1, 2025

🔗 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 Failure

As of commit 5ccdcc5 with merge base 5236a85 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
linux-foundation-easycla bot commented May 1, 2025

CLA Signed

  • ✅login: AnandVishesh1301 / (5ccdcc5)

The committers listed above are authorized under a signed CLA.

@HDCharles HDCharles added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 2, 2025
@@ -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
Copy link
Collaborator
@Skylion007 Skylion007 May 6, 2025

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

@Skylion007
Copy link
Collaborator

@AnandVishesh1301 Please fix the remaining type errors

8000

@AnandVishesh1301
Copy link
Author

@Skylion007 Sure, doing that now. Will create a PR soon. Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open source release notes: AO frontend triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update torch/nn/modules/conv.py to use Literal for support padding modes
4 participants
0