Skip to content

Commit

Permalink
Add tool to find out which ops are needed by a graph
Browse files Browse the repository at this point in the history
  • Loading branch information
reuben committed Aug 2, 2018
1 parent 400c9c0 commit d2be00f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/ops_in_graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import tensorflow as tf
import sys

with tf.gfile.FastGFile(sys.argv[1], 'rb') as fin:
graph_def = tf.GraphDef()
graph_def.MergeFromString(fin.read())

print('\n'.join(sorted(set(n.op for n in graph_def.node))))

0 comments on commit d2be00f

Please sign in to comment.