-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Add missing type hints to anchor_utils #6735
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
Add missing type hints to anchor_utils #6735
Conversation
Hi @vsuryamurthy! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
def generate_anchors( | ||
self, | ||
scales: List[int], | ||
sizes: List[int], |
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 could be a BC-breaking change for users who do named arguments. Shall we keep the original names?
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.
I understand, however this inconsistency does result in a bit of confusion when looking at the code. I assume there is no work around for this but to stick with the old naming?
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.
I will close this PR if there is no work around, do you think the missing type hints are worthy of a separate PR or should I ignore it for now?
Further lines 42-46 (where the aspect_ratios and sizes are checked for a list or tuple) in this file is quite interesting as it makes of an assumption of what the user wants but I think it would be best to error out. What do you think?
All these are minor issues that I faced while playing with the code.
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.
These are all great points @vsuryamurthy. If we were to rewrite the code, we would probably be better naming conventions. The problem is TorchVision comes with very strong BC guarantees and because the method is public, the risk of renaming and breaking user code is quite large. I think you can keep the typing additions of this PR; just revert the variable rename and we should be good to go.
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.
Alright fair enough! I have restored the naming and only added the type hints.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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.
LGTM, thanks!
Summary: * Use the variable name sizes instead of scales for consistency * Add the missing type hints * Restore the naming back to scales instead of sizes to avoid backwards incompatibility Reviewed By: NicolasHug Differential Revision: D40427481 fbshipit-source-id: bf653023c41f2d93597928e4ea0e4461e8b8afc6
This PR also adds the missing type hints.