Skip to content

Instantly share code, notes, and snippets.

@arafatkatze
Last active August 1, 2016 12:01
Show Gist options
  • Save arafatkatze/b2f794f4a4c14a128b725d1d155cc2c9 to your computer and use it in GitHub Desktop.
Save arafatkatze/b2f794f4a4c14a128b725d1d155cc2c9 to your computer and use it in GitHub Desktop.
import tensorflow as tf
from tensorflow.python.platform import gfile
import sys
def converter(filename):
with gfile.FastGFile(filename,'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
tf.import_graph_def(graph_def, name='')
tf.train.write_graph(graph_def, 'pbtxt/', 'protobuf.pbtxt', as_text=True)
return
converter('graph.pb')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment