@@ -575,6 +575,11 @@ def reset_nodes(self, ops):
575
575
self ._dtypes = remained_dtypes
576
576
self ._output_shapes = remained_shapes
577
577
578
+ def is_empty_input (self , name ):
579
+ # in ONNX, operation may have optional input and an empty string may be used
580
+ # in the place of an actual argument's name to indicate a missing argument
581
+ return name == utils .ONNX_EMPTY_INPUT
582
+
578
583
def check_integrity (self ):
579
584
"""
580
585
Check graph integrity. Every node's input needs to associate with a node.
@@ -583,7 +588,7 @@ def check_integrity(self):
583
588
broken_outputs = set ()
584
589
for node in self .get_nodes ():
585
590
for inp in node .input :
586
- if self .get_node_by_output (inp ) is None :
591
+ if self .get_node_by_output (inp ) is None and not self . is_empty_input ( inp ) :
587
592
broken_outputs .add (inp )
588
593
return list (broken_outputs )
589
594
@@ -603,11 +608,12 @@ def update_node_shape_dtype(self, node, override=False):
603
608
initializers = []
604
609
for i , inp in enumerate (node .inputs ):
605
610
if inp is None :
606
- if logger .isEnabledFor (logging .INFO ):
607
- logger .warning (
608
- "[%s] infer a inexistent node: [%s], please check the code" ,
609
- node .name , node .input [i ]
610
- )
611
+ if not self .is_empty_input (node .input [i ]):
612
+ if logger .isEnabledFor (logging .INFO ):
613
+ logger .warning (
614
+ "[%s] infer a inexistent node: [%s], please check the code" ,
615
+ node .name , node .input [i ]
616
+ )
611
617
continue
612
618
if inp .is_const ():
613
619
t = inp .get_attr ("value" )
0 commit comments