onnxruntime
5a69eae9 - Validate Slice starts rank in transpose optimizer (#32044)

Commit
14 days ago
Validate Slice starts rank in transpose optimizer (#32044) This pull request improves the robustness of the Slice optimization logic in the transpose optimizer by adding an additional shape validation check and a corresponding unit test. The main changes ensure that Slice operations with a `starts` input longer than the input tensor's rank are not incorrectly optimized. **Validation improvements:** * Updated `HandleSlice` in `onnx_transpose_optimization.cc` to add a check that the `starts` tensor's length does not exceed the input tensor's rank, preventing invalid optimizations. **Testing:** * Added a new test `TestSliceDefaultAxesStartsLengthExceedsRankNoOpt` in `transpose_optimizer_test.cc` to verify that Slice nodes with `starts` longer than the input rank are not optimized, ensuring correct behavior.
Author
Parents
Loading