-
Notifications
You must be signed in to change notification settings - Fork 365
support aten::index.Tensor #921
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
Conversation
Signed-off-by: Ruoqian Guo <[email protected]>
Signed-off-by: Ruoqian Guo <[email protected]>
|
||
TORCHTRT_CHECK( | ||
tensors.size() == 1, | ||
"This version of Torch-TensorRT only supports one index in aten::index.Tensor"); |
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.
Can you clarify what this means? Can I only do something like tensor[0] or something?
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 Pytorch, 'aten::index.Tensor' can receive several indices, like this:
x = torch.rand(5, 7, 10)
idx0 = torch.tensor([0, 0, 0, 0])
idx1 = torch.tensor([1, 1, 1, 1])
idx2 = torch.tensor([2, 2, 2, 2])
y1 = x[idx0, idx1, idx2] # result is like tensor([x[0, 1, 2], x[0, 1, 2], x[0, 1, 2], x[0, 1, 2]])
y2 = x[idx0] # result is like tensor([x[0, :, :], x[0, :, :], x[0, :, :], x[0, :, :]])
I only support one index as input currently like y2 = x[idx0]
. We can only process tensors[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.
In Pytorch, 'aten::index.Tensor' can receive several indices, like this:
x = torch.rand(5, 7, 10) idx0 = torch.tensor([0, 0, 0, 0]) idx1 = torch.tensor([1, 1, 1, 1]) idx2 = torch.tensor([2, 2, 2, 2]) y1 = x[idx0, idx1, idx2] # result is like tensor([x[0, 1, 2], x[0, 1, 2], x[0, 1, 2], x[0, 1, 2]]) y2 = x[idx0] # result is like tensor([x[0, :, :], x[0, :, :], x[0, :, :], x[0, :, :]])
I only support one index as input currently like
y2 = x[idx0]
. We can only process tensors[0].
Hi @narendasan Is this explanation clear?
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.
Ok can we improve this message to convey what this means
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.
Hi @narendasan i have added some annotation and improved this message.
…sion Signed-off-by: Ruoqian Guo <[email protected]>
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.
LGTM
Fixes #468 |
Description
aten::index.Tensor(Tensor self, Tensor?[] indices) -> (Tensor)
is a complicated PyTorch function which can receive several indices. To focus on Video Swin Transformer, this version converter only supports one index. I will improve this converter in a future release.Fixes #766
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: