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

[Relay][Frontend][Torch] fix pytorch frontend not support logical or #16400

Merged

Conversation

taomiao
Copy link
Contributor

@taomiao taomiao commented Jan 15, 2024

add logical_or op to relay pytorch frontend. #16399

@taomiao taomiao force-pushed the fix/pytorch_frontend_not_support_logical_or branch 2 times, most recently from 75ab5f8 to 0f45ef9 Compare January 15, 2024 08:41
@taomiao
Copy link
Contributor Author

taomiao commented Jan 16, 2024

@masahi @t-vi would you help check this logical_or is ok?

Copy link
Contributor

@t-vi t-vi left a 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__ .

@@ -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,
Copy link
Contributor

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)

Copy link
Contributor Author

@taomiao taomiao Jan 16, 2024

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.

Copy link
Contributor

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.

@taomiao taomiao force-pushed the fix/pytorch_frontend_not_support_logical_or branch from 0f45ef9 to c9d5fc0 Compare January 16, 2024 09:10
Copy link
Contributor

@t-vi t-vi left a 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 .

@masahi masahi merged commit 12ad4fb into apache:main Jan 16, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants