Skip to content
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 comments for ops LastLevelMaxPool to avoid potential confusion #7593

Merged
merged 13 commits into from
May 18, 2023

Conversation

kkaiwwana
Copy link
Contributor

@kkaiwwana kkaiwwana commented May 16, 2023

This PR added some comments for ops LastLevelMaxPool which not really applied a max_pool2d to input but did subsampling actually. These comments attempt to clarify that and avoid potential confusion in future.

@pytorch-bot
Copy link

pytorch-bot bot commented May 16, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7593

Note: Links to docs will display an error until the docs builds have been completed.

❌ 22 New Failures

As of commit a49b786:

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link

Hi @iaoqian!

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@meta.com. Thanks!

@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 17, 2023

Thanks for the PR @iaoqian , however, checking Detectron2 code, they also have kernel_size=1:
https://github.com/facebookresearch/detectron2/blob/d4a5f28e01b2babbaba9f90198fb95f5c661cccd/detectron2/modeling/backbone/fpn.py#L200

and same for Detectron implementation:
https://github.com/facebookresearch/Detectron/blob/6020e9a5aaaa21316cb87a8bc89605e2594310e7/detectron/modeling/FPN.py#L229

Seems like it is intended to have kernel_size=1 as they left a comment:

# Use max pooling to simulate stride 2 subsampling

@NicolasHug
Copy link
Member

Also from the paper:

image

@kkaiwwana
Copy link
Contributor Author

Well, Thanks @vfdev-5 @NicolasHug for your reply. That makes sense. In this way, LastLevelMaxPool may not be a proper name, I think. Maybe we can refactor this class with name 'LastLevelSubsampling' or something to make it more reasonable. But, anyway, closing this PR.

@NicolasHug
Copy link
Member

I agree with you @iaoqian , the current naming might be a bit misleading. Unfortunately we can't really change it because it's public and it would require a deprecation (not sure that it's really worth it). But thanks for sending this PR and for raising this to our attention.
What we can do to avoid such confusion in the future is to clarify in the docstring that the code is intended as-is (i.e. that the Module is just doing subsampling, not max-pooling). Perhaps we can re-purpose your PR for that?

@kkaiwwana
Copy link
Contributor Author

I understand @NicolasHug. I think we can repurpose this PR by adding some code comments to avoid this issue.

@kkaiwwana kkaiwwana changed the title fix ops LastLevelMaxPool add comment for ops LastLevelMaxPool to avoid potential confusion May 17, 2023
@kkaiwwana kkaiwwana changed the title add comment for ops LastLevelMaxPool to avoid potential confusion add comments for ops LastLevelMaxPool to avoid potential confusion May 17, 2023
Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thank you @iaoqian !

@NicolasHug NicolasHug merged commit abc40ef into pytorch:main May 18, 2023
facebook-github-bot pushed a commit that referenced this pull request May 23, 2023
…fusion (#7593)

Summary: Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>

Reviewed By: vmoens

Differential Revision: D46071411

fbshipit-source-id: d2e54d1046a140273ee1df44c87741695800bb8c
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.

4 participants