Skip to content

[Fix][Relax][ONNX] Support Gather and Slice on runtime shape values - #21065

Open
tandede wants to merge 1 commit into
apache:mainfrom
tandede:candidate/tvm-21055-runtime-shape-indexing
Open

tandede wants to merge 1 commit into
apache:mainfrom
tandede:candidate/tvm-21055-runtime-shape-indexing

Conversation

@tandede

@tandede tandede commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Addresses cases 1 and 2 of #21055.

When the end of an ONNX Slice is supplied at runtime, Shape can produce a Relax shape value that cannot be folded during import. Gather then calls shape_of on that value, and Slice cannot determine its tensor rank. Materialize the runtime shape as a 1-D int64 tensor before either operator indexes it. A constant scalar Gather index into a ShapeExpr can still be folded at import time.

The two new opset-18 regression cases compare LLVM CPU output with ONNX Runtime. Both failed before the fix. All 57 selected Gather, Slice, and Shape tests passed with the fix, and pre-commit passed on both changed files.

This branch has not been deployed

No deployments
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.

1 participant