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.