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

Fix bug with LegalizeLayoutTranform which added duplicate ops #81

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions python/tvm/relay/tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ def visit_call(self, expr):
src_layout = expr.attrs['src_layout']
dst_layout = expr.attrs['dst_layout']
if src_layout == "NCHW" and dst_layout == "NHWC":
return relay.transpose(visit, axes=[0, 2, 3, 1])
return relay.transpose(visit.args[0], axes=[0, 2, 3, 1])
elif src_layout == "NHWC" and dst_layout == "NCHW":
return relay.transpose(visit, axes=[0, 3, 1, 2])
return relay.transpose(visit.args[0], axes=[0, 3, 1, 2])
elif src_layout == "HWIO" and dst_layout == "OIHW":
return relay.transpose(visit, axes=[3, 2, 0, 1])
return relay.transpose(visit.args[0], axes=[3, 2, 0, 1])
elif src_layout == "HWOI" and dst_layout == "OIHW":
return relay.transpose(visit, axes=[2, 3, 0, 1])
# may be uneeded
return relay.transpose(visit.args[0], axes=[2, 3, 0, 1])
elif src_layout == "HWIO" and dst_layout == "IOHW":
return relay.transpose(visit, axes=[2, 3, 0, 1])
return relay.transpose(visit.args[0], axes=[2, 3, 0, 1])
return visit

class RemoveDropout(ExprMutator):
Expand Down