-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[ONNX] Add export for __and__ & __or__ #17894
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
Conversation
d36c9ff to
768ff82
Compare
torch/onnx/symbolic.py
Outdated
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.
can we refactor this function with wrap_logical_op_with_cast_to_uint8?
so we will have wrap_func_with_cast_to(func, to_type), and you can directly pass type as a parameter.
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.
done. I have renamed the other to inject_logical_op_with_cast_to. A little context is that in ONNX, And and Or accept only Bool type, so inputs need to be cast to Bool, and output cast back to original type.
70ba283 to
1d04bec
Compare
torch/onnx/symbolic.py
Outdated
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.
is globals() necessary here?
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.
rename cast_func to to_cast_func?
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.
done, globals() is for calling methods created here https://github.com/pytorch/pytorch/blob/270b5814ea0cbcbe5e50b574ff535d8605112b0e/torch/onnx/symbolic.py#L1303
facebook-github-bot
left a comment
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.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
houseroad
left a comment
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.
Looks good, thanks.
|
please rebase to master again, thanks. |
Thanks, rebased. |
facebook-github-bot
left a comment
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.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
rebase please? |
nit nit refactor wrapper merge fix flake8: line too long fix typo fix regression on not supporting boolean and/or rename wrapped func
facebook-github-bot
left a comment
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.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@houseroad merged this pull request in fa18964. |
In onnx spec, the supported input/output type for
AndandOrisBoolonly.Thus in exporting, cast to/from
Boolis inserted for input/output.