keras-onnx
keras-onnx copied to clipboard
AttributeError: 'list' object has no attribute 'name'
Converting a tf-keras 2.2.0/2.3.0 model with multiple output tensors to onnx, I faced the following error:
... in extract_outputs_from_inbound_nodes
op_name = tsname_to_node(ts_.name)
AttributeError: 'list' object has no attribute 'name'
A potential solution that worked for me is:
# enable the following lines from _parser_tf.py to be compatible with list-outputs:
for ts_ in output_tensors:
op_name = tsname_to_node(ts_.name)
if op_name not in output_dict:
output_dict[op_name] = (model, None)
--->
for ts_ in output_tensors:
if not isinstance(ts_, (tuple, list)):
ts_ = [ts_]
for ts__ in ts_:
op_name = tsname_to_node(ts__.name)
if op_name not in output_dict:
output_dict[op_name] = (model, None)
Maybe, in a future version, it is possible to pay respect to these kinds of outputs. Thanks and kind regards :)
@julianjungwirth , would you please propose your fixing as a PR to help other as well?