Created
December 6, 2018 08:20
-
-
Save albb762/25186114fd81e3344b96df8f5329a153 to your computer and use it in GitHub Desktop.
#tensorflow#debug#metadata
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 | |
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment