Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def show_graph_details(graph, mark):
- import tensorflow as tf
- import pprint
- if isinstance(graph, tf.GraphDef):
- with tf.Session(graph=tf.Graph()) as sess:
- tf.import_graph_def(graph)
- graph = sess.graph
- elif isinstance(graph, tf.MetaGraphDef):
- with tf.Session(graph=tf.Graph()) as sess:
- tf.import_graph_def(graph.graph_def)
- graph = sess.graph
- print('[%s] Collections: %s' % (mark, graph.get_all_collection_keys()))
- for col in graph.get_all_collection_keys():
- print(' %s: %s' % (col, graph.get_collection(col)))
- print('')
- print('[%s] Graph Nodes: %s' % (
- mark,
- pprint.pformat([n.name for n in graph.as_graph_def().node])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement