Skip to content

[Relay][Bugfix] fix the wrong calculate logic of operator flip in PyTorch frontend#15752

Merged
MasterJH5574 merged 3 commits into
apache:mainfrom
jikechao:fix_flip
Sep 16, 2023
Merged

[Relay][Bugfix] fix the wrong calculate logic of operator flip in PyTorch frontend#15752
MasterJH5574 merged 3 commits into
apache:mainfrom
jikechao:fix_flip

Conversation

@jikechao

@jikechao jikechao commented Sep 15, 2023

Copy link
Copy Markdown
Member

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

@vvchernov vvchernov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@echuraev echuraev left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread python/tvm/relay/frontend/pytorch.py Outdated
Co-authored-by: Egor Churaev <egor.churaev@gmail.com>
@jikechao jikechao requested a review from echuraev September 15, 2023 13:15

@echuraev echuraev left a comment

Copy link
Copy Markdown
Contributor

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
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.

4 participants