TensorFlow freeze_graph.py: The name 'save/Const:0' refers to a Tensor which does not exist : <p>I am currently trying to export a trained TensorFlow model as a ProtoBuf file to use it with the TensorFlow C++ API on Android. Therefore, I'm using the <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py" rel="noreferrer"><code>freeze_graph.py</code></a> script.</p>

<p>I exported my model using <code>tf.train.write_graph</code>:</p>

<p><code>tf.train.write_graph(graph_def, FLAGS.save_path, out_name, as_text=True)
</code></p>

<p>and I'm using a checkpoint saved with <code>tf.train.Saver</code>.</p>

<p>I invoke <code>freeze_graph.py</code> as described at the top of the script. After compiling, I run</p>

<pre><code>bazel-bin/tensorflow/python/tools/freeze_graph \
--input_graph=&lt;path_to_protobuf_file&gt; \
--input_checkpoint=&lt;model_name&gt;.ckpt-10000 \
--output_graph=&lt;output_protobuf_file_path&gt; \
--output_node_names=dropout/mul_1
</code></pre>

<p>This gives me the following error message:</p>

<pre><code>TypeError: Cannot interpret feed_dict key as Tensor: The name 'save/Const:0' refers to a Tensor which does not exist. The operation, 'save/Const', does not exist in the graph.
</code></pre>

<p>As the error states I do not have a tensor <code>save/Const:0</code> in my exported model. However, the code of <code>freeze_graph.py</code> says that one can specify this tensor name by the flag <code>filename_tensor_name</code>. Unfortunately I cannot find any information on what this tensor should be and how to set it correctly for my model.</p>

<p>Can somebody tell my either how to produce a <code>save/Const:0</code> tensor in my exported ProtoBuf model or how to set the flag <code>filename_tensor_name</code> correctly?</p>
