Skip to content

Commit 4a3ae0a

Browse files
Don't add identity before output if output is also a graph input
Signed-off-by: Tom Wildenhain <[email protected]>
1 parent b53f1bb commit 4a3ae0a

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
@@ -487,6 +487,9 @@ def __init__(self, nodes, output_shapes=None, dtypes=None, target=None, opset=No
487487
# add identity node after each output, in case it is renamed during conversion.
488488
for o in self.outputs:
489489
n = self.get_node_by_output_in_current_graph(o)
490+
if n.is_graph_input():
491+
# Don't add identity if the node is also an input. We want to keep input names the same.
492+
continue
490493
new_output_name = port_name(n.name + "_" + utils.make_name("raw_output_"))
491494
n_shapes = n.output_shapes
492495
n_dtypes = n.output_dtypes

0 commit comments

Comments
 (0)