-
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][Pass] Update SimplifyTranspose to correctly simplify rank changing layout transforms #7807
[Relay][Pass] Update SimplifyTranspose to correctly simplify rank changing layout transforms #7807
Conversation
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.
Thanks for the fix! Overall LGTM. Please add more comments to help future maintaners catch up the logic easily.
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.
Thanks @csullivan for the PR!
Please find some comments.
Overall LGTM!
Thanks @comaniac @ANSHUMAN87! I've extended the support for various rank changing layout transform + transpose patterns. Please see the additional tests for an overview and let me know other change requests you may have. |
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.
LGTM. One bonus suggestion is it would be great to have one comment on the top of each new added test cases to brief explain what's testing.
@csullivan Thanks for the contribution. What's the status on this? I looks like it has a lint error. |
when layout transformation changes rank.
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 great now! 👍
Thanks @csullivan @ANSHUMAN87 |
…nging layout transforms (apache#7807)
…nging layout transforms (apache#7807)
…nging layout transforms (apache#7807)
…nging layout transforms (apache#7807)
…nging layout transforms (apache#7807)
This PR adds support to SimplifyTranspose to simplify consecutive transpose<->layout_transform operations when the layout transform involves a rank expansion or contraction. The added unit test fails on main because the current SimplifyTranspose only doesn't consider the case when the layout transform and transpose may act on tensors of different rank. As an example,
NCHW4c -> LayoutTransform -> NCHW -> Transpose -> NHWC
now simplifies to
NCHW4c -> LayoutTransform -> NHWC
.The reverse, rank expansion, is also supported.