Created
July 25, 2018 18:16
-
-
Save Ouwen/c756ed2567054f3a732049f81eefbf3d to your computer and use it in GitHub Desktop.
Load a tensorflow graph from a .pbtxt
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 | |
from google.protobuf import text_format | |
# Let's read our pbtxt file into a Graph protobuf | |
f = open("/tmp/storage/graph_protobuf.pbtxt", "r") | |
graph_protobuf = text_format.Parse(f.read(), tf.GraphDef()) | |
# Import the graph protobuf into our new graph. | |
graph_clone = tf.Graph() | |
with graph_clone.as_default(): | |
tf.import_graph_def(graph_def=graph_protobuf, name="") | |
# Display the graph inline. | |
graph_clone.as_graph_def() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment