Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 979539c

Browse files
authored
fix ONNX toposort for nodes with 2+ output ids (#327)
1 parent 79166e7 commit 979539c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/sparseml/onnx/utils/graph_editor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ def sort_nodes_topologically(self):
227227
for parent_node_id, child_nodes in self._input_id_to_nodes.items():
228228
if parent_node_id not in self._output_id_to_node:
229229
continue # parent is an initializer, not node
230+
# standardize all references to nodes by their first output id
231+
parent_node_id = self._output_id_to_node[parent_node_id].output[0]
230232
for child_node in child_nodes:
231233
model_dag[child_node.output[0]].add(parent_node_id)
232234
sorted_node_ids = toposort_flatten(model_dag)

0 commit comments

Comments
 (0)