@@ -687,6 +687,7 @@ def _get_unvisited_child(g, node, not_visited):
687
687
all_input = list (filter (lambda a : a != '' , all_input ))
688
688
for inp in all_input :
689
689
j = self .get_node_by_output (inp )
690
+ utils .make_sure (j is not None , "Cannot find node with output {}" .format (inp ))
690
691
if self .parent_graph and j .name not in op_name_to_index :
691
692
# there might be some outer-scoped inputs for an inner Graph.
692
693
pass
@@ -754,6 +755,7 @@ def make_graph(self, doc, graph_name="tf2onnx"):
754
755
placeholder_default_const_ops = []
755
756
for op in placeholder_ops :
756
757
if op .type == "PlaceholderWithDefault" :
758
+ utils .make_sure (op .inputs [0 ] is not None , "Cannot find node with output {}" .format (op .input [0 ]))
757
759
utils .make_sure (op .inputs [0 ].is_const (),
758
760
"non-const default value for PlaceholderWithDefault is not supported." )
759
761
# copy the tensor value, set its name to current node's output, add as initializer
@@ -1027,6 +1029,11 @@ def extract_sub_graph_nodes(self, outputs_name, input_checker=None, ignore_unuse
1027
1029
if node .is_graph_input ():
1028
1030
if node not in res_set :
1029
1031
res_set .add (node )
1032
+ if node .type == "PlaceholderWithDefault" and \
1033
+ node .inputs [0 ].is_const () and \
1034
+ node .inputs [0 ] not in res_set :
1035
+ res_set .add (node .inputs [0 ])
1036
+
1030
1037
return list (res_set )
1031
1038
1032
1039
def delete_unused_nodes (self , outputs_name ):
0 commit comments