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

AnchorGenerator forces torch.arange in fp32 to allow export to onnx #113

Merged
merged 2 commits into from
Jun 24, 2021

Conversation

dkloving
Copy link
Contributor

@dkloving dkloving commented Jun 9, 2021

torch.arange cannot export to onnx with fp16 precision so it is necessary to force the operation into fp32 and then cast the result to the desired dtype.

Fixing #107

torch.arange cannot export to onnx with fp16 precision so it is necessary to force the operation into fp32 and then cast the result to the desired dtype.
@dkloving
Copy link
Contributor Author

dkloving commented Jun 9, 2021

Hmm I'm not sure why this is failing tests.

Copy link
Owner

@zhiqwang zhiqwang left a comment

Choose a reason for hiding this comment

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

@dkloving , Seems that the bug is due to the torchscript exporting, you should specify the type as I mentioned above, I'm not sure if the current modification will affect your needs, let me know what you think about this.

@zhiqwang zhiqwang added the enhancement New feature or request label Jun 14, 2021
@codecov
Copy link

codecov bot commented Jun 23, 2021

Codecov Report

Merging #113 (8ff122f) into master (b0af4a1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #113   +/-   ##
=======================================
  Coverage   83.54%   83.54%           
=======================================
  Files           8        8           
  Lines         784      784           
=======================================
  Hits          655      655           
  Misses        129      129           
Flag Coverage Δ
unittests 83.54% <ø> (ø)

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


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 b0af4a1...8ff122f. Read the comment docs.

@dkloving
Copy link
Contributor Author

@zhiqwang thanks for the suggestion, it looks like that fixed it and this does meet our needs.

@dkloving dkloving requested a review from zhiqwang June 24, 2021 00:14
@zhiqwang zhiqwang merged commit e52771e into zhiqwang:master Jun 24, 2021
Copy link
Owner

@zhiqwang zhiqwang left a comment

Choose a reason for hiding this comment

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

@dkloving LGTM, Thanks for your contributions!

Copy link
Owner

@zhiqwang zhiqwang left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants