[Unity][Op] Extend relax.op.take op to match behavior with topi.take. #14481
Merged
vinx13 merged 3 commits intoapache:unityfrom Apr 5, 2023
Merged
[Unity][Op] Extend relax.op.take op to match behavior with topi.take. #14481vinx13 merged 3 commits intoapache:unityfrom
relax.op.take op to match behavior with topi.take. #14481vinx13 merged 3 commits intoapache:unityfrom
Conversation
Collaborator
|
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 |
psrivas2
approved these changes
Apr 4, 2023
Member
|
as long as the existing behavior are preserved, i think we can support multi-dim index |
Contributor
Author
|
@tqchen I checked that existing tests are passed, so I believe the existing behavior is intact. |
Member
|
@MasterJH5574 would be great if you can help to take a quick look at this one |
MasterJH5574
approved these changes
Apr 5, 2023
| !(indices_sinfo->dtype.is_int() || indices_sinfo->dtype.is_uint())) { | ||
|
|
||
| if (indices_sinfo->IsUnknownDtype()) { | ||
| // TODO(tvm-team): Do we have an equivalent of `ctx->ReportFatal` for warning? |
Contributor
There was a problem hiding this comment.
Leaving as LOG(WARNING) looks fine to me.
Contributor
|
@sunggg Sorry for the delay and thanks for the extension! |
This file contains hidden or 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
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.
Currently,
relax.op.takeimplements semantics of torch.take which has a stronger restriction than its backingtopi.takewhich seems to follow the semantics of numpy.take.i.e.,
relax.op.takeenforces its inputindicesto be 1-d tensor.To match its behavior with
topi.take, this PR extends the semantics ofrelax.op.takeby removing such restriction without breaking existing test cases (except one for checking 1-d tensor restriction).As a result, this PR can support onnx.gather which was the main motivation of my previous PR #14457 by resolving the problem in my previous stab.
cc. @jwfromm @yongwww @MasterJH5574