Skip to content

Instantly share code, notes, and snippets.

@william-r-s
Last active February 17, 2017 22:25
Show Gist options
  • Save william-r-s/dd372ecdb430eeb8f9f39fb7392b7ce1 to your computer and use it in GitHub Desktop.
Save william-r-s/dd372ecdb430eeb8f9f39fb7392b7ce1 to your computer and use it in GitHub Desktop.
tensorflow trace code
from tensorflow.python.client import timeline
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
sess.run([tensor], options=run_options, run_metadata=run_metadata)
# Create the Timeline object, and write it to a json
tl = timeline.Timeline(run_metadata.step_stats)
ctf = tl.generate_chrome_trace_format()
with open('timeline.json', 'w') as f:
f.write(ctf)
# Open in chrome://tracing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment