[TorchONNXToTorch] Failed to lower torch.operator "onnx.Einsum"
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
torch-mlir fails with the following error when running the torch-onnx-to-torch-backend-pipeline on the test case below:
`einsum.mlir:3:10: error: 'torch.aten.permute' op expected input and output tensors to have same rank, but 6 != 25.
%0 = torch.operator "onnx.Einsum"(%arg0, %arg1) {torch.onnx.equation = "...bt pide , ...bo pie -> ...bot pid"} : (!torch.vtensor<[1,1,2,2,3,3],f32>, !torch.vtensor<[1,280,2,2,3],f32>) -> !torch.vtensor<[1,280,1,2,2,3],f32>
^
einsum.mlir:3:10: note: see current operation: %84 = "torch.aten.permute"(%arg0, %83) : (!torch.vtensor<[1,1,2,2,3,3],f32>, !torch.list) -> !torch.vtensor<[1,1,2,2,3,3,94256647605752,94256647577264,6,1,94256647577104,0,1,280,2,2,3,94256647605752,94256647577360,5,94256647577104,0,1,1,280],f32>`
The error can be reproduces using the following command `torch-mlir-opt --torch-onnx-to-torch-backend-pipeline einsum.mlir` with the following test case:
[einsum.mlir](https://github.com/user-attachments/files/26718356/einsum.txt)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running torch-mlir-opt --torch-onnx-to-torch-backend-pipeline einsum.mlir using the attached einsum.mlir test case. Trace the lowering of torch.operator "onnx.Einsum" and the generated torch.aten.permute operation, then ensure the pipeline handles this case without the rank mismatch error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, pytorch
- Domain
- compilers, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100