Skip to content

Add a new fusion pass with pattern of constant and reshape - #62

Open
jiangjiajun wants to merge 4 commits into
onnx:mainfrom
jiangjiajun:constant_reshape
Open

jiangjiajun wants to merge 4 commits into
onnx:mainfrom
jiangjiajun:constant_reshape

Conversation

@jiangjiajun

Copy link
Copy Markdown

No description provided.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Address correctness findings in onnx#62 and add targeted regression coverage. Native builds and focused tests were verified locally on Windows.

Signed-off-by: Andreas Fehlner <fehlner@arcor.de>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andife
andife requested review from a team as code owners October 18, 2026 14:50
@andife

andife commented Oct 18, 2026

Copy link
Copy Markdown
Member

Added a signed-off follow-up fix in 673e6f5, preserving this PR's original contribution and history.

Correct allowzero handling and validate resolved shapes, inferred dimensions, element counts, divisibility, and int64 overflow before mutation. Preserve the folded Constant shape/type.

Validation on Windows after rebuilding the native extension against this branch's pinned ONNX:

  • python -m pytest -o addopts= onnxoptimizer\test\constant_reshape_test.py -q — 16 passed.
  • git diff --check — passed.

Full suite and non-Windows builds were not run locally. This follow-up was prepared with LLM assistance and checked with targeted regression tests (see #357).

@andife andife added the bug Something isn't working label Oct 18, 2026
@andife

andife commented Oct 18, 2026

Copy link
Copy Markdown
Member

@jiangjiajun Could you please address the DCO check for your two original commits, 9792167b00d9af98459816749a4dfcc18ccba0d3 and a32ead008de10de0e18d81fbf0535972dc1d5a76? Both are missing your Signed-off-by trailer. The new follow-up commit is already signed off.

Please preserve the follow-up commit when fixing this; the branch now includes work from multiple contributors, so the DCO bot's blanket rebase/sign-off instructions should not be applied unchanged. Thank you!

Preserve the original contribution and tested follow-up fixes while incorporating current main and its pinned ONNX dependency. Resolve conflicting test annotations/imports or pass registrations without rewriting history.

Signed-off-by: Andreas Fehlner <fehlner@arcor.de>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andife

andife commented Oct 18, 2026

Copy link
Copy Markdown
Member

Merged current main in 7004aed and resolved the pass-registry conflict: retained Constant Reshape fusion and main's registrations without adding duplicates. Original commits and follow-up fixes are preserved; no history rewrite.

Rebuilt the native extension against main's pinned ONNX. python -m pytest -o addopts= onnxoptimizer\test\constant_reshape_test.py onnxoptimizer\test\optimizer_test.py -k reshape -q — 24 passed. Also verified that all available pass names are unique and fuse_constant_reshape is registered exactly once. Ruff passes for the new regression file. Non-Windows/full-suite validation is left to CI.

The separate missing DCO sign-offs on the two original commits still need the author's action, as requested above.

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants