Skip to content

Commit da765aa

Browse files
committed
fail when trying to creating a circle
1 parent 2dcec44 commit da765aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tf2onnx/graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,9 @@ def replace_all_inputs(ops, old_input, new_input):
938938
return
939939

940940
for node in ops:
941+
if old_input in node.input and new_input in node.output:
942+
raise RuntimeError("creating a circle in the graph is not allowed: " + node.name)
943+
941944
for i, input_name in enumerate(node.input):
942945
if input_name == old_input:
943946
node.input[i] = new_input

0 commit comments

Comments
 (0)