-
-
Save morgangiraud/5ef49adc3c608bf639164b1dd5ed3dab to your computer and use it in GitHub Desktop.
medium-tffreeze-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
def load_graph(frozen_graph_filename): | |
# We load the protobuf file from the disk and parse it to retrieve the | |
# unserialized graph_def | |
with tf.gfile.GFile(frozen_graph_filename, "rb") as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
# Then, we import the graph_def into a new Graph and returns it | |
with tf.Graph().as_default() as graph: | |
# The name var will prefix every op/nodes in your graph | |
# Since we load everything in a new graph, this is not needed | |
tf.import_graph_def(graph_def, name="prefix") | |
return graph |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
A simple question, at L15, the "return" statement is outside the "with" scope… is it normal?
Regards.