Skip to content

[Unity] Fix ConvertLayout on binary elemwise ops involving scalar input#14961

Merged
spectrometerHBH merged 5 commits intoapache:unityfrom
masahi:convert-layout-binary-scalar
May 30, 2023
Merged

[Unity] Fix ConvertLayout on binary elemwise ops involving scalar input#14961
spectrometerHBH merged 5 commits intoapache:unityfrom
masahi:convert-layout-binary-scalar

Conversation

@masahi
Copy link
Member

@masahi masahi commented May 26, 2023

Currently when one of the inputs to elemwise op is a scalar, ConvertLayout inserts NHWC -> NCHW fallback conversion, ending up the following undesirable result:

gv: R.Tensor((2, 26, 26, 4), dtype="float32") = R.nn.conv2d(lv, lv1, data_layout="NHWC", kernel_layout="OHWI", out_layout="NHWC")
lv2: R.Tensor((2, 4, 26, 26), dtype="float32") = R.permute_dims(gv, axes=[0, 3, 1, 2])
gv2: R.Tensor((2, 4, 26, 26), dtype="float32") = R.add(lv2, R.const(1, "float32"))

@spectrometerHBH

@tvm-bot
Copy link
Collaborator

tvm-bot commented May 26, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@masahi
Copy link
Member Author

masahi commented May 30, 2023

ping @spectrometerHBH

@spectrometerHBH spectrometerHBH merged commit 34e87ae into apache:unity May 30, 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.

3 participants