Win7下TensorBoard的使用

来源:互联网 发布:精通nginx 第二版 pdf 编辑:程序博客网 时间:2024/05/22 06:32

tensorboard是TensorFlow的一个可视化工具,能够监控TensorFlow运行过程中的计算图,各种指标随着时间的变化趋势以及训练中使用到的图像等信息。

注意:1、必须在终端启动tensorboard,输入tensorboard --logdir =/path/to/log;

      2、如果在tensorboard中发现没找到graph,那么一般是路径没匹配好,修改一下路径即可。

按照例程,写一个可视化graph的代码:

>>> import tensorflow as tf>>> input1 = tf.constant([1.0,2.0,3.0],name = "input1")>>> input2 = tf.Variable(tf.random_uniform([3],name = "input2"))>>> output = tf.add_n([input1,input2],name = "add")>>> writer = tf.train.SummaryWriter("/path/to/log",tf.get_default_graph())Traceback (most recent call last):  File "<stdin>", line 1, in <module>AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'>>> writer = tf.summary.FileWriter("/path/to/log",tf.get_default_graph())>>> writer.close()

问题一: AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'(0.12版本不会出现该问题) 这是因为在1.0版本中,tf.train.SummaryWriter已经改为tf.summary.FileWriter

问题二:当在cmd里输入tensorboard --logdir =/path/to/log时,出现了http://0.0.0.0:6006


但是在浏览器里却打不开此链接,显示:


解决方案:

在cmd里输入tensorboard --logdir =/path/to/log --host=127.0.0.1,问题解决

结果显示:




补充:若出现如图所示现象可以发现,找不到graph,通过查找资料,发现是路径的原因。我们必须给logdir一个明确的路径定义。


                                            图1-1                                            


































原创粉丝点击