Unmesh
Unmesh

Reputation: 3

I am trying to convert .pb file to .mlmodel file. I am getting an error "Tensorflow graph does not contain a tensor with this name"

I tried using tfcoreml and the error is :

Loading the TF graph...

2018-12-05 11:16:50.591360: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

Graph Loaded. Collecting all the 'Const' ops from the graph, by running it.... Done. Traceback (most recent call last): File "converter.py", line 4, in output_feature_names = ['softmax:0']) File "/root/tensorflow-for-poets-2/tf_files/tf-coreml/tfcoreml/_tf_coreml_converter.py", line 586, in convert custom_conversion_functions=custom_conversion_functions) File "/root/tensorflow-for-poets-2/tf_files/tf-coreml/tfcoreml/_tf_coreml_converter.py", line 272, in _convert_pb_to_mlmodel raise ValueError("output name: {}, was provided, but the Tensorflow graph does not contain a tensor with this name.".format(given_out_name)) ValueError: output name: softmax:0, was provided, but the Tensorflow graph does not contain a tensor with this name.

Upvotes: 0

Views: 720

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7892

When you call tfcoreml.convert() you need to supply the name of the tensor with the model's output. You supplied "softmax:0", probably because you saw that in a tutorial somewhere. But apparently this is not the name of the output from your own TensorFlow graph.

You can use a tool called Netron to inspect your graph to see what the name of the output tensor is.

Upvotes: 1

Related Questions