-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Added annotation typing to squeezenet #2865
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2865 +/- ##
=======================================
Coverage 73.36% 73.36%
=======================================
Files 99 99
Lines 8787 8787
Branches 1387 1387
=======================================
Hits 6447 6447
Misses 1916 1916
Partials 424 424
Continue to review full report at Codecov.
|
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 PR!
I have one comment, let me know what you think
torchvision/models/squeezenet.py
Outdated
x = self.features(x) | ||
x = self.classifier(x) | ||
return torch.flatten(x, 1) | ||
|
||
|
||
def _squeezenet(version, pretrained, progress, **kwargs): | ||
def _squeezenet(version: str, pretrained: bool, progress: bool, **kwargs) -> SqueezeNet: |
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.
nit: you are not typing kwargs
here.
Also, should we start enabling mypy tests for each one of the files that we enable?
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.
Nice catch! Just fixed it, that would be good, my local mypy run didn't catch this.
But I'm unsure about how to proceed with this? Any suggestion about the mypy.ini
?
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.
According to @pmeier, the only tests currently disabled are in
Lines 15 to 25 in aa4cf03
[mypy-torchvision.models.detection.*] | |
ignore_errors = True | |
[mypy-torchvision.models.densenet.*] | |
ignore_errors = True | |
[mypy-torchvision.models.quantization.*] | |
ignore_errors = True |
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.
This did not show up since we don't enforce annotations yet. If we hit a significant coverage we should enable disallow_untyped_defs
. Unfortunately, mypy
makes no difference between an untyped and partially typed definition and thus this is disabled for now.
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!
* style: Added annotation typing for squeezenet * feat: Added typing for kwargs
* style: Added annotation typing for squeezenet * feat: Added typing for kwargs
Hi there!
As per #2025, annotation typing are welcome in torchvision. So, this PR focuses on
torchvision.models.squeezenet
this PR!Any feedback is welcome!