Skip to content

Commit 5e0b4f3

Browse files
Remove captured inputs when using CLI (#1533)
* Remove captured inputs when using CLI Signed-off-by: Tom Wildenhain <[email protected]> * Fixed bug Signed-off-by: Tom Wildenhain <[email protected]>
1 parent b4224a5 commit 5e0b4f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tf2onnx/tf_loader.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ def _from_saved_model_v2(model_path, input_names, output_names, tag, signature_d
492492
tensors_to_rename = {}
493493
if input_names is None:
494494
inputs = [tensor.name for tensor in concrete_func.inputs if tensor.dtype != tf.dtypes.resource]
495+
graph_captures = concrete_func.graph._captures # pylint: disable=protected-access
496+
captured_inputs = [t_name.name for _, t_name in graph_captures.values()]
497+
inputs = [inp for inp in inputs if inp not in captured_inputs]
495498
if concrete_func.structured_input_signature is not None:
496499
args, kwargs = concrete_func.structured_input_signature
497500
structured_inputs = [t.name for t in args if isinstance(t, tf.TensorSpec)] + sorted(kwargs.keys())

0 commit comments

Comments
 (0)