-
Notifications
You must be signed in to change notification settings - Fork 24.1k
Update torch/nn/modules/conv.py
to use Literal for support padding modes
#152280
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
Update torch/nn/modules/conv.py
to use Literal for support padding modes
#152280
Comments
can I work on this one? @Skylion007 |
Sure |
Hi! I had asked to work on this issue earlier (see above), and received approval. Would it be possible to coordinate next time to avoid duplication? |
Hi @Skylion007, I understand someone else submitted a PR earlier, but since my implementation includes test verification and follows the suggested corrections, I hope it can still be considered. Appreciate your time reviewing this, and happy to make any changes needed. Thanks! |
Hi @Skylion007 , I'd be happy to take a look at the current mypy type error and help resolve the linting failure related to Literal[...] usage in conv.py. Let me know if it's alright for me to jump in and contribute a patch on top of the current implementation. Thanks! |
* Defines PaddingMode alias * Annotates Conv{1,2,3}d constructors * Fixes pytorch#152280
"HI i'd like to work on this.Can I take it? |
The following files also have similar type annotation issues , torch/ao/nn/qat/modules/conv.py and torch/ao/nn/quantized/modules/conv.py . The QAT version has different padding mode support. The quantized version has a restricted set of supported padding modes (_SUPPORTED_PADDING = {"zeros", "reflect"}) should we file issues to fix those too ? @Skylion007 |
π The feature, motivation and pitch
It would be great to update
torch/nn/modules/conv.py
to use typing.Literal instead of juststr
to denote with padding modes are actually supported by various operations.for example instead of
padding_mode : str
do
padding_mode: Literal["valid", "same"]
etc to the type checker can catch bugs for the code is actually ran.Alternatives
No response
Additional context
No response
cc @ezyang @malfet @xuzhao9 @gramster
The text was updated successfully, but these errors were encountered: