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

Fix warning with torch.meshgrid #1402

Merged
merged 3 commits into from
Jun 3, 2022

Conversation

pallgeuer
Copy link
Contributor

@pallgeuer pallgeuer commented May 30, 2022

Motivation

torch.meshgrid() has started raising a warning when not called with an explicit indexing parameter:
https://pytorch.org/docs/stable/generated/torch.meshgrid.html

Modification

Provide indexing='ij' to all calls to torch.meshgrid that don't already specify indexing.

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit tests to ensure correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • CLA has been signed and all committers have signed the CLA in this PR.

@pallgeuer
Copy link
Contributor Author

Refer to open-mmlab/mmdetection#8090 (comment) for discussion on PyTorch version support of torch.meshgrid.

@ly015
Copy link
Member

ly015 commented May 30, 2022

@pallgeuer Thank you very much for your help!

@pallgeuer pallgeuer force-pushed the fix_torch_meshgrid branch from d7ac45a to 2d19d9f Compare June 2, 2022 09:20
@pallgeuer
Copy link
Contributor Author

I have updated the pull request to now correctly deal with PyTorch versions above and below 1.10.0 using a wrapper. Can the PR be reviewed if all is well now?

@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #1402 (3bb29a1) into master (d3c17d5) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1402      +/-   ##
==========================================
+ Coverage   84.16%   84.34%   +0.18%     
==========================================
  Files         232      232              
  Lines       19308    19279      -29     
  Branches     3472     3468       -4     
==========================================
+ Hits        16250    16261      +11     
+ Misses       2183     2152      -31     
+ Partials      875      866       -9     
Flag Coverage Δ
unittests 84.28% <92.30%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmpose/models/detectors/multiview_pose.py 69.66% <100.00%> (+0.09%) ⬆️
mmpose/models/utils/__init__.py 100.00% <100.00%> (ø)
mmpose/models/utils/misc.py 100.00% <100.00%> (ø)
mmpose/core/visualization/__init__.py 100.00% <0.00%> (ø)
mmpose/core/visualization/effects.py
mmpose/datasets/pipelines/top_down_transform.py 76.96% <0.00%> (+1.08%) ⬆️
mmpose/datasets/pipelines/shared_transform.py 83.26% <0.00%> (+8.15%) ⬆️
mmpose/datasets/builder.py 78.94% <0.00%> (+9.21%) ⬆️
mmpose/utils/setup_env.py 100.00% <0.00%> (+27.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3c17d5...3bb29a1. Read the comment docs.

@ly015 ly015 force-pushed the fix_torch_meshgrid branch from 811450c to 3bb29a1 Compare June 3, 2022 12:18
@ly015 ly015 merged commit c8e91ff into open-mmlab:master Jun 3, 2022
shuheilocale pushed a commit to shuheilocale/mmpose that referenced this pull request May 5, 2023
* Fix warning with torch.meshgrid

* Add meshgrid wrapper that is sensitive to torch version

* move misc.py from mmpose.utils to mmpose.model.utils

Co-authored-by: ly015 <liyining0712@gmail.com>
ajgrafton pushed a commit to ajgrafton/mmpose that referenced this pull request Mar 6, 2024
* Fix warning with torch.meshgrid

* Add meshgrid wrapper that is sensitive to torch version

* move misc.py from mmpose.utils to mmpose.model.utils

Co-authored-by: ly015 <liyining0712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants