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

Exported tensorflow model outputs don't use onnx model output names

Open krishnanNuance opened this issue 3 years ago • 4 comments

The exported TF model doesn't use the output names specified while exporting the onnx models. The onnx output model names are: onnx_output_names =[node.name for node in model.graph.output]

onnx output names: ['output', 'hidden_state', 'cell_state']

But tensorflow-> model.signatures["serving_default"].outputs

[Identity:0, Identity_1:0, Identity_2:0]

Is there a way to change this?

krishnanNuance avatar Apr 09 '21 07:04 krishnanNuance

You should be able to find the structured outputs using m.signatures['serving_default'].structured_outputs

chinhuang007 avatar Apr 09 '21 22:04 chinhuang007

Using structured_outputs, I get ['Output0', 'Output1', 'Output2 '].

krishnanNuance avatar Apr 12 '21 05:04 krishnanNuance

Hi, I am using onnx-tf==1.9.0 and I am getting "serving_default_input:0" as input name and "PartitionedCall:0" as output name although they were all named something else in the onnx model.

philip-fu avatar Dec 13 '21 21:12 philip-fu

Are you looking at the pb file from a viewer like Netron? Unfortunately the generated pb is part of a TF saved model, not a pure computational graph. In order to see the model input and output names, you need to run code using tf.saved_model API.

chinhuang007 avatar Dec 16 '21 18:12 chinhuang007