-
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
[Frontend][Pytorch]Add Pytorch advanced indexing #6318
Conversation
data = inputs[0] | ||
indices = [] | ||
max_indices_len = -1 | ||
for index in inputs[1]: |
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.
seems these two for loops are able to be merged
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.
max_indices_len
needs to be fetched first.
if index_key in slice_map: | ||
tmp = slice_map[index_key] | ||
else: | ||
tmp = _op.take(tmp, _expr.const(index[i]), axis=0) |
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.
out of curiosity, would this introduce many take and tile ops?
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.
In most cases it should be fine, but we can definitely improve it by adding a new topi implementation.
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 am okay with this for now. We can implement a topi op if when perf is not good.
Thanks @kevinthesun @zhiics @yongwww |
* Add Pytorch advanced indexing * Minor fix for test * Fix for cuda
* Add Pytorch advanced indexing * Minor fix for test * Fix for cuda
* Add Pytorch advanced indexing * Minor fix for test * Fix for cuda
* Add Pytorch advanced indexing * Minor fix for test * Fix for cuda
* Add Pytorch advanced indexing * Minor fix for test * Fix for cuda
This PR adds support for Pytorch advanced indexing
aten::index
and also fixes an issue in Pytorch slice mapping.@masahi @yongwww @zhiics