Skip to content

Commit b75fe78

Browse files
committed
Check output_names attr as well.
Signed-off-by: Jay Zhang <[email protected]>
1 parent 6d1f789 commit b75fe78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tf2onnx/convert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ def _rename_duplicate_keras_model_names(model):
328328
IMPORTANT: model may be edited. Assign model.output_names to old_out_names to restore.
329329
"""
330330
old_out_names = None
331-
if model.output_names and len(set(model.output_names)) != len(model.output_names):
331+
if hasattr(model, "output_names") and model.output_names \
332+
and len(set(model.output_names)) != len(model.output_names):
332333
# In very rare cases, keras has a bug where it will give multiple outputs the same name
333334
# We must edit the model or the TF trace will fail
334335
old_out_names = model.output_names

0 commit comments

Comments
 (0)