Skip to content

Disable fuse_consecutive_squeezes pass for negative axes#293

Merged
take-cheeze merged 2 commits intoonnx:mainfrom
take-cheeze:consec_sq_neg_axes
Mar 22, 2026
Merged

Disable fuse_consecutive_squeezes pass for negative axes#293
take-cheeze merged 2 commits intoonnx:mainfrom
take-cheeze:consec_sq_neg_axes

Conversation

@take-cheeze
Copy link
Copy Markdown
Member

@take-cheeze take-cheeze requested review from a team as code owners February 26, 2026 12:09
Signed-off-by: take-cheeze <takechi101010@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_squeezes to 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.

@take-cheeze take-cheeze merged commit 7942e19 into onnx:main Mar 22, 2026
28 checks passed
@take-cheeze take-cheeze deleted the consec_sq_neg_axes branch March 22, 2026 04:56
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.

3 participants