TensorBoard 是 TensorFlow 内建的过程可视化工具,会在安装 TensorFlow 的过程中默认安装。如果需要使用 TensorBoard 进行可视化,需要将想要可视化的操作和变量通过 tf.summary
操作进行记录,并通过 tf.summary.FileWriter
输出至 events 文件,再通过读取这个文件进行可视化。
TensorBoard operates by reading TensorFlow events files, which contain summary data that you can generate when running TensorFlow. Here's the general lifecycle for summary data within TensorBoard.
For example, suppose you are training a convolutional neural network for recognizing MNIST digits. You'd like to record how the learning rate varies over time, and how the objective function is changing. Collect these by attaching
tf.summary.scalar
ops to the nodes that output the learning rate and loss respectively. Then, give eachscalar_summary
a meaningfultag
, like'learning rate'
or'loss function'
.