tensorboard查看tensor占用内存及运行时间

总结自:https://www.tensorflow.org/guide/graph_viz#runtime_statistics
https://blog.csdn.net/fu6543210/article/details/80235720

设置sess.run中option为FULL_TRACE,然后将输出的metadata写到writer里即可,样例代码如下:

run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
summary, _ = sess.run([merged,train_step],
                      feed_dict=feed_dict(True),
                      options=run_options,
                      run_metadata=run_metadata)
train_writer.add_run_metadata(run_metadata, 'step%d' % i)
train_writer.add_summary(summary, i)

笔者还遇到了找不到libcupti.so.9.0的bug,因为该文件不在CUDA标准路径内,需要另行添加,详见TensorFlow报 Couldn’t open CUDA library libcupti.so.9.0. LD_LIBRARY_PATH: /usr/local/cuda-9.0/lib64

你可能感兴趣的:(Tensorflow)