Repository navigation
fix(rewriter): preserve PRelu data-input expansion - #3147
Open
DiadkoShmek wants to merge 1 commit into
Open
DiadkoShmek wants to merge 1 commit into
DiadkoShmek wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Removing an Expand from PRelu's data input can turn a valid model into one rejected by full ONNX checking and strict shape inference. PRelu broadcasts the slope to the data shape; its other input cannot supply bidirectional broadcasting to justify that rewrite.
For example,
x: float[3]expanded to[2,3]with afloat[2,3]slope is valid. The current rewrite removes Expand, after which shape inference reports rank 1 against the declared rank 2 output. Omit only the first/data-input PRelu rule, retaining slope-side removal and every other operator's registrations.Six regressions fail full validation on the original rule, and the safe slope-side control passes. After the change all 21 tests in the rule module pass. An independently generated 124-case check covers rank/singleton growth, symbolic and unknown dimensions, runtime targets, shared graph outputs and Add/Mul controls; all fixed graphs pass both validators.
lintrunner -aandgit diff --checkpass.This concerns the exported opt-in
expand_before_binary_op_rules, not the default optimizer rule list. ONNX Runtime permissively computes the same values for the invalid original rewrite; no numerical runtime failure is claimed. Conservatively retaining a redundant data-side Expand is intentional.AI assistance: OpenAI Codex investigated, implemented and independently checked this change with pinned local Python/ONNX/ORT dependencies. No human code review, full-suite validation or upstream acceptance is claimed.