Skip to content

Preserve overridable initializer defaults in rewrite rules - #3195

Open
Justin Chu (justinchuby) wants to merge 1 commit into
mainfrom
justinchuby-overridable-initializer-rewrite-safety
Open

Justin Chu (justinchuby) wants to merge 1 commit into
mainfrom
justinchuby-overridable-initializer-rewrite-safety

Conversation

@justinchuby

Copy link
Copy Markdown
Collaborator

Summary

  • Treat graph-input initializer tensors as overridable defaults, not runtime constants, without clearing defaults or changing input signatures.
  • Guard literal matching and constant-based shape, Slice, padding, Min/Max, bias, ScatterND, function-extraction, and opt-in ORT fusion paths using the existing constant helper.
  • Add ORT regressions with omitted defaults and explicit overrides, true-constant positive controls, nested graph captures, and per-parameter guards. Correct Min/Max tests that expected defaults to be folded.

Separate from constant-folder changes in #3189 and unresolved-attribute handling in #3191. The matcher change does not touch #3168's candidate enumeration.

Validation

  • Rewriter and optimizer suites: 715 passed, 3 skipped; 102 subtests passed.
  • Ruff lint/format and diff checks pass; helper and new tests pass mypy.
  • Public optimizer Add/Sub/Mul/Div preserve runtime overrides and original ModelProto defaults; true initializer and Constant operands still simplify.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.31579% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.96%. Comparing base (f51083c) to head (b52a6ae).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...nxscript/rewriter/_overridable_initializer_test.py 98.52% 1 Missing and 1 partial ⚠️
onnxscript/rewriter/ort_fusions/cos_sin_cache.py 50.00% 1 Missing and 1 partial ⚠️
...ipt/rewriter/ort_fusions/fused_matmul_rule_sets.py 33.33% 0 Missing and 2 partials ⚠️
onnxscript/rewriter/rules/common/_basic_rules.py 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3195      +/-   ##
==========================================
+ Coverage   73.77%   73.96%   +0.18%     
==========================================
  Files         270      271       +1     
  Lines       33876    34023     +147     
  Branches     3243     3262      +19     
==========================================
+ Hits        24993    25166     +173     
+ Misses       7829     7804      -25     
+ Partials     1054     1053       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant