Repository navigation
[FIX][ONNX] Avoid duplicate parameters for ONNX initializer inputs - #21137
Open
shpetimhaxhiu wants to merge 1 commit into
Open
shpetimhaxhiu wants to merge 1 commit into
shpetimhaxhiu wants to merge 1 commit into
Conversation
Register required graph inputs separately from initializer-backed parameters. Reported-by: tangyixuan01 (apache#21133) Generated-by: OpenAI Codex (GPT-6)
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.
Fixes #21133. Thanks to @tangyixuan01 for isolating the duplicate variable and the LLVM compilation failure.
The ONNX importer registers initializers before parsing graph inputs. When an initializer also appears in
graph.input, the importer currently appends the same Relax variable once as a model input and again as a parameter. The LLVM build fails with a variable-used-before-definition error.This change registers only newly created model inputs in the input list. With
keep_params_in_input=True, initialized values still appear exactly once in the trailing parameter list and retain their initializer values afterdetach_params. The regression uses two initializers interleaved with a required input and checks both parameter modes. On native Windows x64 LLVM, the compiled model matched ONNX Runtime with the default weights and with an explicitly supplied replacement weight.All 17 targeted tests passed. The full Windows frontend comparison had 84 failures shared with the unpatched baseline. The new initializer regression was the only test whose result changed.
OpenAI Codex assisted with the implementation and validation.