Repository navigation
fix(export): preserve graph order for input encoding assignment - #4153
Open
Santosh Todkar (todkarsant) wants to merge 1 commit into
Open
Santosh Todkar (todkarsant) wants to merge 1 commit into
Santosh Todkar (todkarsant) wants to merge 1 commit into
Conversation
Replace set() with ordered list + dedup set for start_op_names in _get_layer_input_tensors, matching the pattern already used on the output side in find_op_names_for_layer. set() iteration order depends on PYTHONHASHSEED, so when a module expands to many ONNX ops (e.g. ScatterND ~40 ops), input encodings get zip'd to wrong tensors — data encoding can land on the updates path, an integer Shape output, or the indices input. Fixes qualcomm#4141 Signed-off-by: Santosh Todkar <todkarsant@gmail.com>
Author
|
michaelgtuttle Could you review? This fixes the non-deterministic input encoding assignment during ONNX export reported in #4141. |
Author
|
Abhi Khobare (@abhikhobare) Could you review this PR? It preserves graph order for input encoding assignment during ONNX export. Thanks! |
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.
Summary
set()with ordered list + dedup set forstart_op_namesin_get_layer_input_tensors, fixing non-deterministic input encoding assignment during ONNX exportProblem
When
EXPORT_TO_ONNX_DIRECT = True,_get_layer_input_tensorsbuildsstart_op_namesas a Pythonset(). Since set iteration order depends onPYTHONHASHSEED, the resultinginput_tensorslist has non-deterministic order. When this list is laterzip'd withinput_encodingsby index, encodings get assigned to the wrong ONNX tensors.For modules that expand to many ONNX ops (e.g. ScatterND with ~40 ops), the encoding for input 0 (
data) can land on theupdatespath, an integerShapeoutput, or theindicesinput.Fix
Use
list + setfor dedup (preserving graph order fromop_names), matching the pattern already used on the output side infind_op_names_for_layer(lines 1527-1546).Fixes #4141