From df66dba90698658a4da54f3115f36af8a3f9abe9 Mon Sep 17 00:00:00 2001 From: fynnsu Date: Tue, 14 Mar 2023 14:21:17 -0400 Subject: [PATCH] Speed up ONNX graphsurgeon toposort Signed-off-by: fynnsu --- tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py b/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py index f785a553..1ebd1cf7 100644 --- a/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py +++ b/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py @@ -409,6 +409,7 @@ def add_local_producers(tensor): except RecursionError: G_LOGGER.critical("Cycle detected in graph! Are there tensors with duplicate names in the graph?") + hierarchy_levels[self._get_node_id(node)] = HierarchyDescriptor(node, level=max_input_level+1) return max_input_level + 1 with self.node_ids():