Skip to content

Instantly share code, notes, and snippets.

@sunsheng
Forked from jubjamie/pb_viewer.py
Created January 15, 2019 10:20
Show Gist options
  • Save sunsheng/2cae31432ff6404ceccb8bee509cc1cb to your computer and use it in GitHub Desktop.
Save sunsheng/2cae31432ff6404ceccb8bee509cc1cb to your computer and use it in GitHub Desktop.
Load .pb into Tensorboard
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment