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][Bugfix] fix the wrong calculate logic of operator flip in PyTorch frontend #15752

Merged
merged 3 commits into from
Sep 16, 2023

Conversation

jikechao
Copy link
Contributor

@jikechao jikechao commented Sep 15, 2023

The original implementation of Flip in PyTorch converter mistaken the type of attribute axis in the Flip operator as an integer. Thus, It only parses the first element of the axis and will give a wrong calculation result when the length of axis is more than one. According to the PyTorch documentation here, the type of axis is a list or tuple.

This PR corrected the incorrect implementation of the algorithm of torch.flip converter and added a regression test.

cc @echuraev @Hzfengsy @MasterJH5574

correct the calculate logic of flip in pytorch converter
@jikechao jikechao changed the title [Relay][Bugfix] fix the calculate logic of operator Flip in PyTorch frontend [Relay][Bugfix] fix the wrong calculate logic of operator flip in PyTorch frontend Sep 15, 2023
Copy link
Contributor

@vvchernov vvchernov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

In general LGTM. Thanks for fixing bugs in TVM! Small comment.

python/tvm/relay/frontend/pytorch.py Outdated Show resolved Hide resolved
Co-authored-by: Egor Churaev <egor.churaev@gmail.com>
Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@MasterJH5574 MasterJH5574 merged commit 61d5be0 into apache:main Sep 16, 2023
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.

None yet

4 participants