Skip to content

Commit 2554534

Browse files
authored
raise error if signature is missing (#1406)
Signed-off-by: Guenther Schmuelling <[email protected]>
1 parent 99e2706 commit 2554534

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tf2onnx/convert.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,10 @@ def from_keras(model, input_signature=None, opset=None, custom_ops=None, custom_
304304
An ONNX model_proto and an external_tensor_storage dict.
305305
"""
306306
if LooseVersion(tf.__version__) < "2.0":
307-
raise NotImplementedError("from_keras requires tf-1.15 or newer")
307+
raise NotImplementedError("from_keras requires tf-2.0 or newer")
308+
309+
if not input_signature:
310+
raise ValueError("from_keras requires input_signature")
308311

309312
from tensorflow.python.keras.saving import saving_utils as _saving_utils # pylint: disable=import-outside-toplevel
310313

@@ -364,7 +367,10 @@ def from_function(function, input_signature=None, opset=None, custom_ops=None, c
364367
An ONNX model_proto and an external_tensor_storage dict.
365368
"""
366369
if LooseVersion(tf.__version__) < "2.0":
367-
raise NotImplementedError("from_keras requires tf-1.15 or newer")
370+
raise NotImplementedError("from_function requires tf-2.0 or newer")
371+
372+
if not input_signature:
373+
raise ValueError("from_function requires input_signature")
368374

369375
concrete_func = function.get_concrete_function(*input_signature)
370376

0 commit comments

Comments
 (0)