tensorflow-onnx icon indicating copy to clipboard operation
tensorflow-onnx copied to clipboard

add mypy type hints to reduce possible sources of error

Open andife opened this issue 1 year ago • 0 comments

Before submitting your request, please review past submissions to ensure that it is not a duplicate of a known feature request.

Describe the feature request

Add mypy type hints to code (for example https://github.com/onnx/tensorflow-onnx/blob/baf5ad0855ed709d4857c6effc2b25f65723816c/tf2onnx/convert.py#L412)

def from_keras(model, input_signature=None, opset=None, custom_ops=None, custom_op_handlers=None, custom_rewriter=None, inputs_as_nchw=None, outputs_as_nchw=None, extra_opset=None, shape_override=None, target=None, large_model=False, output_path=None, optimizers=None):

Type hints would reduce possible sources of error here.

For example, the following is possible in the CLI:

python -m tf2onnx.convert --opset 10 --outputs-as-nchw output --inputs-as-nchw input --saved-model .\saved_models\,

but not in the code, as a list is expected.

andife avatar Jan 23 '24 10:01 andife