-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Type annotations for torchvision/utils.py #2034
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
Conversation
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.
Looks great, thanks a lot!
I have a few comments.
Also, I was wondering if we should setup some CI to run mypy in the code (for the files that support type annotation). It would be as simple as writing something like
Lines 18 to 22 in 504d20c
- env: LINT_CHECK | |
python: "3.6" | |
install: pip install flake8 typing | |
script: flake8 .circleci | |
after_success: [] |
in the travis CI, but installing mypy and running it in the files that have type annotation. Do you think you could do it in a follow-up PR?
Also, test failures are related
|
Could you link me to the failing test? I can't find it within Edit: Found it in the Travis CI test. At least for me this is not shown within checks for this PR. Do you have an idea why? Failure is already fixed through a commit addressing one of the review comments. |
Running
|
@pmeier
Let's ignore PIL annotations (there is a way to tell mypy to ignore annotations from specific modules), and wait until PIL add type annotations to its functions 2 - I think we just need to properly make Additionally, instead of adding the mypy test in |
I'll open a new PR for that and rebase this when the other is merged. |
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 a lot @pmeier !
@fmassa I'm confused why you merged this. Does that mean you want me to continue without |
@pmeier this PR is very self-contained for now, and I think the next step should be to add CI for type annotations and targeting only this file -- this way we can have signal that our annotations are correct and compliant. What do you think? |
* type annotations for torchvision/utils.py * add missing annotation for make_grid * fix annotation for save_image * mirror PIL annotation for fp
Summary: * type annotations for torchvision/utils.py * add missing annotation for make_grid * fix annotation for save_image * mirror PIL annotation for fp Pull Request resolved: #2428 Reviewed By: zhangguanheng66 Differential Revision: D22437423 Pulled By: fmassa fbshipit-source-id: 77a46deb22e4fbf4de02f9f7d0e418c656d40a65
Addresses #2025