Disable fuse_consecutive_squeezes pass for negative axes#293
Merged
take-cheeze merged 2 commits intoonnx:mainfrom Mar 22, 2026
Merged
Disable fuse_consecutive_squeezes pass for negative axes#293take-cheeze merged 2 commits intoonnx:mainfrom
take-cheeze merged 2 commits intoonnx:mainfrom
Conversation
Signed-off-by: take-cheeze <takechi101010@gmail.com>
359f919 to
be8b921
Compare
|
justinchuby
approved these changes
Mar 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Disables the fuse_consecutive_squeezes optimization when either Squeeze uses negative axes, addressing onnxsim/onnxsim#33 by avoiding an unsafe fusion scenario.
Changes:
- Add a guard in
FuseConsecutiveSqueezes::compose_squeezesto bail out when any axis is negative. - Add a regression test ensuring consecutive Squeezes with negative axes are not fused.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| onnxoptimizer/test/optimizer_test.py | Adds a regression test that asserts the pass does not fuse consecutive Squeezes when axes are negative. |
| onnxoptimizer/passes/fuse_consecutive_squeezes.h | Adds an early-return condition to skip fusion when negative axes are present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



For onnxsim/onnxsim#33