Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import tensorflow as tf
  2. from tensorflow.python.client import timeline
  3.  
  4. a = tf.random_normal([2000, 5000])
  5. b = tf.random_normal([5000, 1000])
  6. res = tf.matmul(a, b)
  7.  
  8. with tf.Session() as sess:
  9. # add additional options to trace the session execution
  10. options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
  11. run_metadata = tf.RunMetadata()
  12. sess.run(res, options=options, run_metadata=run_metadata)
  13.  
  14. # Create the Timeline object, and write it to a json file
  15. fetched_timeline = timeline.Timeline(run_metadata.step_stats)
  16. chrome_trace = fetched_timeline.generate_chrome_trace_format()
  17. with open('timeline_01.json', 'w') as f:
  18. f.write(chrome_trace)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement