Skip to content

Commit

Permalink
Improves robustness in node ordering (#1004)
Browse files Browse the repository at this point in the history
* Improves robustness in node ordering

Signed-off-by: Xavier Dupre <[email protected]>

* lint

Signed-off-by: Xavier Dupre <[email protected]>

---------

Signed-off-by: Xavier Dupre <[email protected]>
  • Loading branch information
xadupre authored Jul 21, 2023
1 parent c71601e commit 8950c6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions skl2onnx/common/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,8 @@ def nstr(name):
"\n".join(rows)))

# Update order
topo = sorted([(order[id(node)], str(id(node)))
topo = sorted([(order[id(node)], node.op_type,
node.name, str(id(node)))
for node in self.nodes])
map_nodes = {str(id(node)): node for node in self.nodes}
self.nodes = [map_nodes[_[1]] for _ in topo]
self.nodes = [map_nodes[_[-1]] for _ in topo]

0 comments on commit 8950c6f

Please sign in to comment.