Graph
or Computional Graph
- the basic concept of a tensor flow to represent calculations. When you use tenorflow, you first create your own Computation Graph
and pass this one Graph
to tenorflow. How to do it? As you probably know, flow tensor supports many foreground programming languages such as Python, C ++, Java, and Go, and the main language is C ++; how do other languages convert Graph
to C ++? They use a tool called protobuf
that can generate specific language stubs from where GraphDef
. This is a serialized version Graph
.
which one do I need to run the graph loaded from the protobuf file (.pb)
*pb
, GraphDef
bind
GraphDef
( ) Graph
, Graph
, :
import tensorflow as tf
from tensorflow.python.platform import gfile
with tf.Session() as sess:
model_filename ='PATH_TO_PB.pb'
with gfile.FastGFile(model_filename, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
g_in = tf.import_graph_def(graph_def)
LOGDIR='/logs/tests/1/'
train_writer = tf.summary.FileWriter(LOGDIR)
train_writer.add_graph(sess.graph)