You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Digging into the PyTorch output some more, I believe that PyTorch is creating a new tensor for this __getitem__ op variation (which would make sense, since we can create larger/different shaped tensors than what we're originally indexing, and the storage is different). This can be observed using data_ptr() to check the mem address of the indexed tensor:
To replicate this behavior in TRT/torch2trt, we'll likely need to add the ability to handle list/tensor inputs as index arguments, and produce new tensors as the output.
The text was updated successfully, but these errors were encountered:
Adding to this, tuple arguments have the same behavior iff combined with ... or :.
ie.
t = torch.rand(3, 4, 5)
t[(1, 2)] == t[1][2] # This should be handled by #768 and generally
t[(1, 2), ...] == t[(1, 2), :] == t[[1, 2]] # Not currently supported; ie. this issue.
torch.Tensor.__getitem__
supports list ortorch.Tensor
inputs for indexing, which appears to not convert correctly currently intorch2trt
.In other words, we'd like to perform the following ops, which currently fails or produces incorrect outputs after
torch2trt
conversion:This can be demonstrated with the following script:
getitem-tensors.py
:Outputs:
Note the following from the output:
Input tensor:
Expected output (regardless of whether we're indexing using lists or tensors):
Output using list to index:
Output using tensor to index:
Digging into the PyTorch output some more, I believe that PyTorch is creating a new tensor for this
__getitem__
op variation (which would make sense, since we can create larger/different shaped tensors than what we're originally indexing, and the storage is different). This can be observed usingdata_ptr()
to check the mem address of the indexed tensor:To replicate this behavior in TRT/
torch2trt
, we'll likely need to add the ability to handle list/tensor inputs as index arguments, and produce new tensors as the output.The text was updated successfully, but these errors were encountered: