参考网上的:https://github.com/tensorflow/tensorflow/issues/8854
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='YOUR_LOG_LOCATION' train_writer = tf.summary.FileWriter(LOGDIR) train_writer.add_graph(sess.graph)