Skip to content

Commit

Permalink
Skip unregistering optional inputs/outputs that are empty (onnx#1467)
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wildenhain <tomwi@microsoft.com>
  • Loading branch information
TomWildenhain-Microsoft authored and zerollzeng committed May 16, 2021
1 parent 3b1a0d8 commit 9c2f25f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tf2onnx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ def remove_node(self, node_name):
self.inputs.remove(node)

for op_output in node.output:
if op_output == "":
continue
del self._output_to_node_name[op_output]

if op_output in self._output_shapes:
Expand All @@ -699,6 +701,8 @@ def remove_node(self, node_name):
del self._dtypes[op_output]

for op_input in node.input:
if op_input == "":
continue
utils.make_sure(
op_input in self._output_to_consumers,
"Input %r of node %r not found.", op_input, node_name)
Expand Down

0 comments on commit 9c2f25f

Please sign in to comment.