Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The from_tflite() function should accept None as default value of input_names and output_names. #1967

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Conversation

fatcat-z
Copy link
Collaborator

@fatcat-z fatcat-z commented Jun 14, 2022

When converting a tflite model to an onnx ModelProto using from_tflite() function, 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 which causes a bug.

So the function should not change None to an empty list for both input_names and output_names arguments. This PR fixes this problem. Add related tests as well.

Fix #1963

System information

Signed-off-by: Jay Zhang jiz@microsoft.com

…empty list for input_names and output_names.

Signed-off-by: Jay Zhang <jiz@microsoft.com>
@fatcat-z fatcat-z requested a review from hwangdeyu June 14, 2022 04:27
Signed-off-by: Jay Zhang <jiz@microsoft.com>
Copy link
Contributor

@hwangdeyu hwangdeyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fatcat-z fatcat-z enabled auto-merge (squash) June 15, 2022 06:17
@fatcat-z fatcat-z merged commit 89c4c5c into onnx:main Jun 15, 2022
@fatcat-z fatcat-z deleted the fix_tflite_issue branch June 15, 2022 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tflite model graph output name defaults to an empty list when using from_tflite
2 participants