-
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][Legalize] Legalize conv2d_transpose for NHWC #4399
[Relay][Legalize] Legalize conv2d_transpose for NHWC #4399
Conversation
cf65f02
to
717ac15
Compare
@anijain2305 Can you take a look? |
@merrymercy Can you have a look as well? |
elif kernel_layout == 'OIHW': | ||
# input kernel layout is swapped to IOHW | ||
# output kernel layout will be IOHW | ||
pass |
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.
How about just removing this code?
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 see, this is needed, otherwise legalization wont happen
# output kernel layout will be IOHW | ||
pass | ||
else: | ||
raise ValueError("Invalid kernel_layout {}".format(kernel_layout)) |
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.
We can do return None
here. That is if some topi schedule supports this particular combination of layouts, it will fallback to that.
Return None basically means legalize does not transform anything.
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.
fixed
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 overall. Minor changes.
717ac15
to
4efed1a
Compare
4efed1a
to
2d1bccf
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.
LGTM
Thanks @apivovarov |
This PR Legalizes conv2d_transpose for NHWC.
I need to compile
palm_detection.tflite
model from mediapipe.This model uses
TRANSPOSE_CONV
op. TFLite models uses NHWC data layout only.In order to add TRANSPOSE_CONV to TFLite frontend I need to Legalize conv2d_transpose for NHWC first.
The fact that weights layout and kernel_layout should have flipped IO is very confusing.
I added comments about it in code.