-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Relay][Frontend][Torch] fix pytorch frontend not support logical or #16400
[Relay][Frontend][Torch] fix pytorch frontend not support logical or #16400
Conversation
75ab5f8
to
0f45ef9
Compare
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.
Thank you for submitting the PR. The logical_or
looks good, I have doubts about the __or__
.
python/tvm/relay/frontend/pytorch.py
Outdated
@@ -4237,7 +4243,9 @@ def create_convert_map(self): | |||
"torchvision::deform_conv2d": self.deform_conv2d, | |||
"aten::unbind": self.unbind, | |||
"aten::__and__": self.logical_and, | |||
"aten::__or__": self.logical_or, |
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.
I'm afraid this is not tested and also not quite right.
While torch.logical_or(torch.tensor(2), torch.tensor(1))
gives tensor(True)
,
torch.ops.aten.__or__(torch.tensor(2), torch.tensor(1))
gives tensor(3)
(and torch.tensor(2) or torch.tensor(1))
gives tensor(2)
, so it is different yet)
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.
Ok, I removed aten::__or__
from the convert_map.
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.
Thank you. Seems good to me now.
0f45ef9
to
c9d5fc0
Compare
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 to me. Thank you @taomiao .
add logical_or op to relay pytorch frontend. #16399