Open linmeimei0512 opened 1 year ago
My environment is:
My final goal: ONNX model convert to tflite.
Question: My ONNX model input name is [input], output name is [output1, output2]
[input]
[output1, output2]
ONNX convert to Tensorflow is use SavedModel format in Tensorflow 2.x.
SavedModel
import onnx from onnx_tf.backend import prepare onnx_model = onnx.load(onnx_model_path) onnx_tf_exporter = prepare(onnx_model) onnx_tf_exporter.export_graph(tensorflow_model_output_path)
I display output model (saved_model.pb) in Netron, input name is not equal to ONNX.
Then I convert the SavedModel to tflie.
import tensorflow as tf converter = tf.lite.TFLiteConverter.from_saved_model(tensorflow_model_path) converter.optimizations = [tf.lite.Optimize.DEFAULT] tflite_model = converter.convert() with open(tensorflow_lite_model_output_path, 'wb') as f: f.write(tflite_model)
Tflie model input name is equal to SavedModel [serving_default_input:0], output name is [StatefulPartitionedCall:1, StatefulPartitionedCall:1]
[serving_default_input:0]
[StatefulPartitionedCall:1, StatefulPartitionedCall:1]
Please how can I make tflite input name and output name equal to ONNX?
duplicate https://github.com/onnx/onnx-tensorflow/issues/984
My environment is:
My final goal: ONNX model convert to tflite.
Question: My ONNX model input name is
[input]
, output name is[output1, output2]
ONNX convert to Tensorflow is use
SavedModel
format in Tensorflow 2.x.I display output model (saved_model.pb) in Netron, input name is not equal to ONNX.
Then I convert the SavedModel to tflie.
Tflie model input name is equal to SavedModel
[serving_default_input:0]
, output name is[StatefulPartitionedCall:1, StatefulPartitionedCall:1]
Please how can I make tflite input name and output name equal to ONNX?