Skip to content

Instantly share code, notes, and snippets.

@alreadytaikeune
Created August 13, 2018 12:41
Show Gist options
  • Save alreadytaikeune/a135cd4e3f0905f8ec05c50c0976505a to your computer and use it in GitHub Desktop.
Save alreadytaikeune/a135cd4e3f0905f8ec05c50c0976505a to your computer and use it in GitHub Desktop.
from tensorflow.python.framework import graph_util
# Suppose you have obtained in a way or the other a graph object, and suppose
# you have a list of the output nodes names (manually created after inspectection
# with tensorboard for example). Then, one way to build a frozen graph is the following:
with tf.Session(graph=graph) as sess:
graph_def = graph.as_graph_def()
frozen_graph_def = graph_util.convert_variables_to_constants(
sess, graph_def, output_node_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment