-
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][Layout] Add FInferCorrectLayout for L2 norm layout transform. #12497
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blackkker
changed the title
[Relay][Layout] Add FInferCorrectLayout for L2 norm layout change.
[Relay][Layout] Add FInferCorrectLayout for L2 norm layout transform.
Aug 19, 2022
masahi
approved these changes
Aug 19, 2022
blackkker
force-pushed
the
L2N_InferCorrectLayout
branch
from
August 19, 2022 12:25
3614f98
to
d995ec7
Compare
@tvm-bot rerun CI / Windows (pull_request) |
blackkker
force-pushed
the
L2N_InferCorrectLayout
branch
from
August 19, 2022 16:50
d995ec7
to
0d39fb3
Compare
@tvm-bot rerun |
This comment was marked as resolved.
This comment was marked as resolved.
blackkker
force-pushed
the
L2N_InferCorrectLayout
branch
from
August 20, 2022 08:28
76f716e
to
61f499b
Compare
@tvm-bot merge |
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 25, 2022
…apache#12497) * [Relay][Layout] FInferCorrectLayout for L2 norm layout change. * [Relay][Layout] Test for L2 norm layout transform. * [Relay][Layout] Re-edit test to add multi-dimensional axis list. * Fix cpplint errors * Use clang-format-10 rules. * replace uint with size_t.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
FInferCorrectLayout
was set toElemwiseArbitraryLayout
which is for layout agnostic operators. While L2norm is a lightly-layout sensitive operator withattrs-axis
. Refered to Convert Layout Pass.tvm/src/relay/op/nn/nn.cc
Line 672 in 72b0f5e
When running model, I met a situation:
%0 = layout_transform(%x, src_layout="NHWC", dst_layout="NCHW") /* ty=Tensor[(1, 64, 56, 56), float32] */;
%1 = layout_transform(%weight, src_layout="HWIO", dst_layout="OIHW") /* ty=Tensor[(64, 64, 3, 3), float32] */;
%2 = nn.conv2d(%0, %1, padding=[1, 1, 1, 1], channels=64, kernel_size=[3, 3]) /* ty=Tensor[(1, 64, 56, 56), float32] */;
%3 = nn.l2_normalize(%2, eps=0.001f, axis=[3]) /* ty=Tensor[(1, 64, 56, 56), float32] */;
The nn.l2_normalize 's axis didn't change during
InferCorrectLayout
. So i write aL2NormalizeInferCorrectLayout
for it.Also, add some tests.
BTW! I'm still new to cpp, please advise if there is anything inappropriate in code. Thanks!
Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.