Last active
February 6, 2018 09:25
-
-
Save yaroslavvb/22de3a093482e821fe1c703c07593877 to your computer and use it in GitHub Desktop.
Example of using stats summarizer
This file contains hidden or 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
# 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