Skip to content

Instantly share code, notes, and snippets.

@mrubash1
Created March 6, 2017 23:01
Show Gist options
  • Save mrubash1/49ff0bc33c5ef63a960f473d2d21ef43 to your computer and use it in GitHub Desktop.
Save mrubash1/49ff0bc33c5ef63a960f473d2d21ef43 to your computer and use it in GitHub Desktop.
Create and persist a TensorFlow Graph
def create_and_persist_graph():
with tf.Session() as persisted_sess:
# Load Graph
with tf.gfile.FastGFile(modelFullPath,’rb’) as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
persisted_sess.graph.as_default()
tf.import_graph_def(graph_def, name=’’)
return persisted_sess.graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment