Skip to content

Commit 0ba6133

Browse files
committed
remove input_signature in from_keras_tf1()
Signed-off-by: hwangdeyu <[email protected]>
1 parent c70f3a4 commit 0ba6133

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ The reason for this is that there is a dynamic input of a tensorflow op but the
3333

3434
An example of this is the [ONNX Slice operator before opset-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Slice-1) - the start and end of the slice are static attributes that need to be known at graph creation. In tensorflow the [strided slice op](https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/strided-slice) allows dynamic inputs. tf2onnx will try to find the real value of begin and end of the slice and can find them in most cases. But if those are real dynamic values calculate at runtime it will result in the message ```get tensor value: ... must be Const```.
3535

36-
You can pass the options ```--fold_const(deprecated after tf2onnx-1.9.3)``` in the tf2onnx command line that allows tf2onnx to apply more aggressive constant folding which will increase chances to find a constant.
36+
You can pass the options ```--fold_const```(removed after tf2onnx-1.9.3) in the tf2onnx command line that allows tf2onnx to apply more aggressive constant folding which will increase chances to find a constant.
3737

3838
If this doesn't work the model is most likely not to be able to convert to ONNX. We used to see this a lot of issue with the ONNX Slice op and in opset-10 was updated for exactly this reason.

tf2onnx/convert.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ def _is_legacy_keras_model(model):
352352
return False
353353

354354

355-
def _from_keras_tf1(model, input_signature=None, opset=None, custom_ops=None, custom_op_handlers=None,
356-
custom_rewriter=None, inputs_as_nchw=None, extra_opset=None, shape_override=None,
357-
target=None, large_model=False, output_path=None):
355+
def _from_keras_tf1(model, opset=None, custom_ops=None, custom_op_handlers=None, custom_rewriter=None,
356+
inputs_as_nchw=None, extra_opset=None, shape_override=None, target=None,
357+
large_model=False, output_path=None):
358358
"""from_keras for tf 1.15"""
359359
input_names = [t.name for t in model.inputs]
360360
output_names = [t.name for t in model.outputs]
@@ -422,8 +422,8 @@ def from_keras(model, input_signature=None, opset=None, custom_ops=None, custom_
422422
An ONNX model_proto and an external_tensor_storage dict.
423423
"""
424424
if LooseVersion(tf.__version__) < "2.0":
425-
return _from_keras_tf1(model, input_signature, opset, custom_ops, custom_op_handlers, custom_rewriter,
426-
inputs_as_nchw, extra_opset, shape_override, target, large_model, output_path)
425+
return _from_keras_tf1(model, opset, custom_ops, custom_op_handlers, custom_rewriter, inputs_as_nchw,
426+
extra_opset, shape_override, target, large_model, output_path)
427427

428428
old_out_names = _rename_duplicate_keras_model_names(model)
429429
from tensorflow.python.keras.saving import saving_utils as _saving_utils # pylint: disable=import-outside-toplevel

0 commit comments

Comments
 (0)