-
Notifications
You must be signed in to change notification settings - Fork 456
Description
Describe the bug
When converting a tflite model to an onnx ModelProto using the newly-available function tf2onnx.convert.from_tflite
, if the output_names
argument is not specified, it defaults to an empty list instead of None
.
However, in the tf2onnx.tflite_utils.graphs_from_tflite
function, if the output_names
argument is not None
, the output names retrieved automatically by the tf2onnx.tflite_utils.parse_tflite_graph
function are overwritten, resulting in a ModelProto with no output.
System information
- OS Platform and Distribution: Windows 10
- Tensorflow version: 2.8.0
- tf2onnx version: 1.11.1
- Python version: 3.8.13
To Reproduce
Use the tf2onnx.convert.from_tflite
function to convert a tflite model without specifying the output_names
argument. This results in the returned ModelProto.graph to have its output
attribute set to []
.
Additional context
A simple fix would be to delete those 2 lines
if output_names is None:
output_names = []
at the top of the tf2onnx.convert.from_tflite
function. It would also be more consistent with the CLI equivalent:
python -m tf2onnx.convert --tflite <path_to_tflite> --output <output_path>
that results in the output_names
argument to default to None
(which means no bug when using the CLI).