Skip to content

Commit d2baed0

Browse files
authored
Merge pull request #392 from pengwa/fix_graph_input_order
fix python3.5 issue - subgraph input orders are lost after loading Gr…
2 parents 966a65d + 1030373 commit d2baed0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tf2onnx/graph.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,10 @@ def _parse_graph_initializer(g, graph_proto):
12121212
def _parse_graph_input(g, graph_proto, const_node_names):
12131213
"""Get graph inputs not defined as initializers and put into Graph object."""
12141214
shapes, dtypes = GraphUtil._parse_shape_and_type_from_value_infos(graph_proto.input)
1215-
for name in shapes:
1215+
# make sure the input is added in order we read from graph_proto,
1216+
# because for subgraphs, the input orders matter.
1217+
for graph_input in graph_proto.input:
1218+
name = graph_input.name
12161219
shape = shapes[name]
12171220
dtype = dtypes[name]
12181221
if name not in const_node_names:

0 commit comments

Comments
 (0)