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 deprecation warning in nonzero #2705

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented Sep 24, 2020

Fixes #2704 and #2154 and subsumes #2314

Instead of passing as_tuple keyword to nonzero, we instead replace nonzero by where, now that it works with just the condition argument.

This should hopefully work with torchscript and ONNX.

Replace nonzero by where, now that it works with just a condition
@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

Merging #2705 into master will decrease coverage by 0.13%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2705      +/-   ##
==========================================
- Coverage   72.82%   72.68%   -0.14%     
==========================================
  Files          95       95              
  Lines        8212     8212              
  Branches     1283     1283              
==========================================
- Hits         5980     5969      -11     
- Misses       1838     1848      +10     
- Partials      394      395       +1     
Impacted Files Coverage Δ
torchvision/models/detection/_utils.py 85.03% <50.00%> (ø)
torchvision/models/detection/generalized_rcnn.py 88.52% <100.00%> (ø)
torchvision/models/detection/roi_heads.py 82.34% <100.00%> (ø)
torchvision/models/detection/rpn.py 92.70% <100.00%> (-0.43%) ⬇️
torchvision/ops/boxes.py 100.00% <100.00%> (ø)
torchvision/ops/poolers.py 97.05% <100.00%> (ø)
torchvision/extension.py 48.64% <0.00%> (-21.63%) ⬇️
torchvision/ops/deform_conv.py 66.66% <0.00%> (-3.34%) ⬇️

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 1b41525...fab457e. Read the comment docs.

@fmassa fmassa merged commit 15848ed into pytorch:master Sep 24, 2020
@fmassa fmassa deleted the fix-nonzero-deprecation branch September 24, 2020 09:18
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
Replace nonzero by where, now that it works with just a condition
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
Replace nonzero by where, now that it works with just a condition
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.

UserWarning: This overload of nonzero is deprecated
1 participant