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

Fix onnx.Gather lowering with dynamic shapes #3675

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

jinchen62
Copy link
Collaborator

@jinchen62 jinchen62 commented Aug 29, 2024

Supports the result with dynamic shape and scalar indices like

func.func @test_gather_scalar(%arg0: !torch.vtensor<[3,4,5],f32>, %arg1: !torch.vtensor<[], si64>) -> !torch.vtensor<[?,?],f32> attributes {torch.onnx_meta.opset_version = 13 : si64} {
  %0 = torch.operator "onnx.Gather"(%arg0, %arg1) {torch.onnx.axis = 0 : si64} : (!torch.vtensor<[3,4,5],f32>, !torch.vtensor<[], si64>) -> !torch.vtensor<[?,?],f32>
  return %0 : !torch.vtensor<[?,?],f32>
}

Torch::AtenSqueezeOp is referring to the result shape, so it will failed on lowering if the result shape is dynamic.

@jinchen62 jinchen62 merged commit fd759e4 into llvm:main Aug 30, 2024
3 checks passed
@jinchen62 jinchen62 deleted the onnx_gather_dynamic branch August 30, 2024 00:02
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.

2 participants