Skip to content

Conversation

vsuryamurthy
Copy link
Contributor

@vsuryamurthy vsuryamurthy commented Oct 10, 2022

This PR also adds the missing type hints.

@facebook-github-bot
Copy link
Contributor

Hi @vsuryamurthy!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

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],
Copy link
Contributor

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?

Copy link
Contributor Author

@vsuryamurthy vsuryamurthy Oct 10, 2022

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@vsuryamurthy vsuryamurthy changed the title Consistent naming and add missing type hints to anchor_utils Add missing type hints to anchor_utils Oct 10, 2022
@vsuryamurthy vsuryamurthy requested a review from datumbox October 10, 2022 19:32
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@datumbox datumbox merged commit 3099e0c into pytorch:main Oct 11, 2022
@vsuryamurthy vsuryamurthy deleted the consistent_naming_missing_type_hinting_anchor_utils branch October 11, 2022 08:02
facebook-github-bot pushed a commit that referenced this pull request Oct 17, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants