Skip to content

Commit d130591

Browse files
committed
remove keras_learning_phase, replace runtimeerror by make_sure
1 parent c9aa7ab commit d130591

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tf2onnx/graph.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,10 @@ def reset_nodes(self, ops):
690690
if o not in self._output_to_node_name:
691691
raise ValueError("graph output " + o + " not exist")
692692
for i in self.inputs:
693-
if i.name.startswith('Placeholder'):
694-
continue
695-
if i.name.startswith('keras_learning_phase'):
693+
if i.is_graph_input(): # i.name.startswith('Placeholder'):
696694
continue
695+
# if i.name.startswith('keras_learning_phase'):
696+
# continue
697697
if i.name not in self._output_to_consumers:
698698
raise ValueError("graph input %r not exist in graph." % i.name)
699699

@@ -1191,11 +1191,10 @@ def remove_input(self, node, to_be_removed, input_index=None):
11911191

11921192
for i, name in enumerate(node.input):
11931193
if name == to_be_removed:
1194-
if node.input.count(node.input[i]) > 1:
1195-
raise RuntimeError(
1196-
"Node '{}' takes multiple times the same input '{}'. "
1197-
"This case is not handled.".format(
1198-
node.name, node.input[i]))
1194+
utils.make_sure(
1195+
node.input.count(node.input[i]) <= 1,
1196+
"Node %r takes multiple times the same input %r. This case is not handled.",
1197+
node.name, node.input[i])
11991198
self._unregister_input_name(node.input[i], node)
12001199
del node.input[i]
12011200
break

0 commit comments

Comments
 (0)