Skip to content
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

[MLIR][TORCH] Add support for negative step in aten.slice.Tensor op #3763

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

vivekkhandelwal1
Copy link
Collaborator

@vivekkhandelwal1 vivekkhandelwal1 commented Oct 4, 2024

This commit adds the support for negative step values in aten.slice.Tensor op. Although, PyTorch does not allow negative step value for slice op but the Onnx.Slice op supports negative step value which eventually lowers to torch.aten.slice.Tensor op. Hence, the support is added for handling those kind of values during the Torch->Linalg lowering of aten.slice.Tensor op.

Signed-Off By: Vivek Khandelwal vivekkhandelwal1424@gmail.com

@vivekkhandelwal1 vivekkhandelwal1 changed the title [MLIR][TORCH] Add support for negative step in torch.aten.slice.Tenso… [MLIR][TORCH] Add support for negative step in aten.slice.Tensor op Oct 4, 2024
This commit adds the support for negative step values in aten.slice.Tensor
op. Although, PyTorch does not allow negative step value for slice op
but the Onnx.Slice op supports negative step value which eventually lowers
to torch.aten.slice.Tensor op. Hence, the support is added for handling
those kind of values during the Torch->Linalg lowering of aten.slice.Tensor op.

Signed-Off By: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
@vivekkhandelwal1 vivekkhandelwal1 merged commit f6721e5 into llvm:main Oct 8, 2024
3 checks passed
@vivekkhandelwal1 vivekkhandelwal1 deleted the onnx-slice branch October 8, 2024 05:04
Copy link
Collaborator

@kumardeepakamd kumardeepakamd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you ensure that a test with -ve axis works?

lib/Conversion/TorchToLinalg/DataMovement.cpp Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants