Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Fix] Fix DCN fp16 #1014

Merged
merged 2 commits into from
May 11, 2021
Merged

[Fix] Fix DCN fp16 #1014

merged 2 commits into from
May 11, 2021

Conversation

shinya7y
Copy link
Contributor

@shinya7y shinya7y commented May 8, 2021

Motivation

Fix #1004

Modification

Cast DCN weights by type_as, not by autocast.

BC-breaking (Optional)

No.

@CLAassistant
Copy link

CLAassistant commented May 8, 2021

CLA assistant check
All committers have signed the CLA.

@shinya7y
Copy link
Contributor Author

shinya7y commented May 8, 2021

Another solution with autocast (with more manual fix):
(1) Change _addmm to addmm in deform_conv_cuda.cu
https://pytorch.org/docs/stable/amp.html#autocast-op-reference
(2) Apply custom_fwd and custom_bwd
https://pytorch.org/docs/stable/notes/amp_examples.html#autocast-and-custom-autograd-functions

To support PyTorch < 1.6, code for (2) will be long.

@codecov
Copy link

codecov bot commented May 8, 2021

Codecov Report

Merging #1014 (8ee2f20) into master (db6b054) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 8ee2f20 differs from pull request most recent head c0edcf6. Consider uploading reports for the commit c0edcf6 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1014   +/-   ##
=======================================
  Coverage   64.57%   64.57%           
=======================================
  Files         152      152           
  Lines        9792     9793    +1     
  Branches     1779     1779           
=======================================
+ Hits         6323     6324    +1     
  Misses       3141     3141           
  Partials      328      328           
Flag Coverage Δ
unittests 64.57% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
mmcv/ops/deform_conv.py 61.76% <100.00%> (+0.28%) ⬆️

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 db6b054...c0edcf6. Read the comment docs.

@ZwwWayne
Copy link
Collaborator

Hi @shinya7y ,
Thanks for the PR. We plan to merge it in a few days. Before that, could you add comments to indicate the reason for the modification or refer the issue in the code?

@ZwwWayne ZwwWayne mentioned this pull request May 10, 2021
13 tasks
@ZwwWayne ZwwWayne self-requested a review May 11, 2021 05:16
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError: expected scalar type Half but found Float (DCN, fp16, MMCV 1.3.2)
3 participants