microsoft/onnxscript

[Optimizer] Fold Shape -> {Slice, Gather} -> Concat -> Reshape

Open

#2,736 opened on Dec 17, 2025

 (2 comments) (0 reactions) (0 assignees)Python (117 forks)auto 404
contribution welcomegood first issuemodule: rewriter

Repository metrics

Stars
 (445 stars)
PR merge metrics
 (PR metrics pending)

Description

In Shape -> {Slice, Gather} -> Concat -> Reshape, when the dynamic axis coming from Shape is a single axis and the rest of the dimensions are not -1, we can replace the shape for Reshape to have a static -1 axis, and eliminate the nodes for dynamic shape evaluation.

Contributor guide