Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- from tensorflow.python.client import timeline
- a = tf.random_normal([2000, 5000])
- b = tf.random_normal([5000, 1000])
- res = tf.matmul(a, b)
- with tf.Session() as sess:
- # add additional options to trace the session execution
- options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
- run_metadata = tf.RunMetadata()
- sess.run(res, options=options, run_metadata=run_metadata)
- # Create the Timeline object, and write it to a json file
- fetched_timeline = timeline.Timeline(run_metadata.step_stats)
- chrome_trace = fetched_timeline.generate_chrome_trace_format()
- with open('timeline_01.json', 'w') as f:
- f.write(chrome_trace)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement