TensorBoard是TensorFlow下的一个可视化的工具,能够帮助我们在训练大规模神经网络过程中出现的复杂且不好理解的运算。TensorBoard能展示你训练过程中绘制的图像、网络结构等。
首先我介绍一下官方文档上启动TensorBoard的方法:
1、首先把log写入到文件中
代码如下:
import tensorflow as tf
with tf.variable_scope("foo"):
a = tf.get_variable("bar", [1])
print (a.name)
with tf.variable_scope("bar"):
b = tf.get_variable("bar", [1])
print (b.name)
with tf.name_scope("a"):
a = tf.Variable([1])
print (a.name)
a = tf.get_variable("b", [1])
print (a.name)
with tf.name_scope("input1"):
input1 = tf.constant([1.0, 2.0, 3.0], name="input1")
with tf.name_scope("input2"):
input2 = tf.Variable(tf.random_uniform([3]), name="input2")
output = tf.add_n([input1, input2], name="add")
writer = tf.summary.FileWriter("F:\logs", tf.get_default_graph())
writer.close()
运行后在F:\logs路径下回有一个文件,如下图:
2、现在我们来启动TensorBoard:
注意:一定要先到上一级目录下面,比如我先进入F盘,然后再运行tensorboard –logdir=logs
(logdir前面是两个“-”,这边可能编辑的问题,直接复制不对)
最后在浏览器中打开(最好用google浏览器,其他浏览器有可能打不开)
输入:http://localhost:6006/
结果如下:
转载自:https://blog.csdn.net/hongxue8888/article/details/69389171