Last active
April 12, 2018 23:37
-
-
Save domluna/f06921196b539a397a6a24ae7f571276 to your computer and use it in GitHub Desktop.
Print the size in bytes of a Tensorflow GraphDef
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 main(): | |
files = ['model-' + str(x) for x in range(20000, 70000, 10000)] | |
for f in files: | |
with tf.Graph().as_default(): | |
sess = tf.Session() | |
saver = tf.train.import_meta_graph('./test_graph_size/' + f + '.meta') | |
saver.restore(sess, './test_graph_size/' + f) | |
print(sess.graph_def.ByteSize()) | |
if __name__ == "__main__": | |
main() | |
I have the result of:
IOError: File ./test_graph_size/model-20000.meta does not exist.
I appreciate your comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Outputs:
30376060
35425130
40474200
45523270
50572340