3

The Android example that comes with Tensorflow downloads a protobuf file for InceptionV3 which contains both the graph and the values from the model. In the docs, I could only find how to serialize the graph (tf.Graph.as_graph_def) or save the variable values with a tf.train.Saver. How can you save everything to a single file, as done for that example?

jfsantos
  • 835
  • 5
  • 20

1 Answers1

5

I answered a similar question on this topic: Is there an example on how to generate protobuf files holding trained Tensorflow graphs?

The basic idea is to use tf.import_graph_def() to replace the variables in the original (training) graph with constants, and then write out the resulting GraphDef using tf.Graph.as_graph_def().

Community
  • 1
  • 1
mrry
  • 125,488
  • 26
  • 399
  • 400