-
-
Save monklof/55a6e1f3d73201eb8ff14b929aa98540 to your computer and use it in GitHub Desktop.
tf_timeline.py
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 | |
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE) | |
run_metadata = tf.RunMetadata() | |
predictions = use_sess.run(use_out, {'DecodeJpeg/contents:0': image_file.file.getvalue()}, 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment