-
Notifications
You must be signed in to change notification settings - Fork 152
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
Conversation
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.
Hmm I'm not sure why this is failing tests. |
There was a problem hiding this 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.
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
=======================================
Coverage 83.54% 83.54%
=======================================
Files 8 8
Lines 784 784
=======================================
Hits 655 655
Misses 129 129
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
@zhiqwang thanks for the suggestion, it looks like that fixed it and this does meet our needs. |
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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