TF save/restore graph fails at tf.GraphDef.ParseFromString()
<p>Based on this <a href="https://stackoverflow.com/questions/35247406/converting-trained-tensorflow-model-to-protobuf">converting-trained-tensorflow-model-to-protobuf</a> I am trying to save/restore TF graph without success. </p>

<p>Here is saver:  </p>

<pre class="lang-py prettyprint-override"><code>with tf.Graph().as_default():
    variable_node = tf.Variable(1.0, name="variable_node")
    output_node = tf.mul(variable_node, 2.0, name="output_node")
    sess = tf.Session()
    init = tf.initialize_all_variables()
    sess.run(init)
    output = sess.run(output_node)
    tf.train.write_graph(sess.graph.as_graph_def(), summ_dir, 'model_00_g.pbtxt', as_text=True)
    #self.assertNear(2.0, output, 0.00001)
    saver = tf.train.Saver()
    saver.save(sess, saver_path)
</code></pre>

<p>which produces <code>model_00_g.pbtxt</code> with text graph description. Pretty much copy paste from <a href="https://github.com/tensorflow/tensorflow/blob/00440e99ffb1ed1cfe4b4ea650e0c560838a6edc/tensorflow/python/tools/freeze_graph_test.py#L79" rel="noreferrer">freeze_graph_test.py</a>.</p>

<p>Here is reader:  </p>

<pre class="lang-py prettyprint-override"><code>with tf.Session() as sess:

    with tf.Graph().as_default():
        graph_def = tf.GraphDef()
        graph_path = '/mnt/code/test_00/log/2016-02-11.22-37-46/model_00_g.pbtxt'
        with open(graph_path, "rb") as f:
            proto_b = f.read()
            #print proto_b   # -&gt; I can see it
            graph_def.ParseFromString(proto_b) # no luck..
            _ = tf.import_graph_def(graph_def, name="")

    print sess.graph_def
</code></pre>

<p>which fails at <code>graph_def.ParseFromString()</code> with <code>DecodeError: Tag had invalid wire type.</code></p>

<p>I am on docker container <code>b.gcr.io/tensorflow/tensorflow:latest-devel</code> in case it makes any difference. </p>