From 315c95c0a1f4354746c14f5b50bc09e87a290b94 Mon Sep 17 00:00:00 2001 From: xhdhr10000 Date: Fri, 2 Aug 2024 18:26:27 +0800 Subject: [PATCH] onnx-graphsurgeon: fix cycle detection bug in toposort Signed-off-by: xhdhr10000 --- 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 b40968f4..06acd19f 100644 --- a/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py +++ b/tools/onnx-graphsurgeon/onnx_graphsurgeon/ir/graph.py @@ -595,6 +595,7 @@ def get_used_funcs(nodes): return inputs if get_id(node_or_func) in hierarchy_levels: + visited.remove(get_id(node_or_func)) return hierarchy_levels[get_id(node_or_func)].level # The level of a node is the level of its highest input + 1.