Skip to content

Instantly share code, notes, and snippets.

@qijiexu
Forked from nithishdivakar/pb_viewer.py
Created March 4, 2018 01:14
Show Gist options
  • Select an option

  • Save qijiexu/61bcf9e6231aaa1a77326c97845135dd to your computer and use it in GitHub Desktop.

Select an option

Save qijiexu/61bcf9e6231aaa1a77326c97845135dd 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/file'
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="./"
train_writer = tf.summary.FileWriter(LOGDIR)
train_writer.add_graph(sess.graph)
train_writer.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment