Skip to content

Instantly share code, notes, and snippets.

@yaroslavvb
Last active February 6, 2018 09:25
Show Gist options
  • Save yaroslavvb/22de3a093482e821fe1c703c07593877 to your computer and use it in GitHub Desktop.
Save yaroslavvb/22de3a093482e821fe1c703c07593877 to your computer and use it in GitHub Desktop.
Example of using stats summarizer
# export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
import tensorflow as tf
a = tf.ones((10, 10))
b = tf.ones((10, 10))
c = tf.matmul(a, b)
ss = tf.contrib.stat_summarizer.NewStatSummarizer(tf.get_default_graph().as_graph_def().SerializeToString())
sess = tf.Session()
for i in range(10):
run_metadata = tf.RunMetadata()
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
sess.run(c, options=run_options, run_metadata=run_metadata)
ss.ProcessStepStatsStr(run_metadata.step_stats.SerializeToString())
print(ss.GetOutputString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment