tensorboard使用指南

1 tensorflow 环境搭建完成
2 代码如下
import  tensorflow as tf
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("logs/", tf.get_default_graph())
writer.close()
3代码执行方式
python3.6 test_tensorflow.py
4 启动tensorboard
tensorboard --host=20.5.194.73 --port=6099 --logdir="logs"

 5其它问题TensorBoard使用和问题解决

5.1python tensorflow/tensorboard/tensorboard.py --logdir=path/to/log-directory

logdir指向SummaryWriter序列化数据的存储路径,通过在浏览器中输入localhost:6006来查看TensorBoard

5.2启动在服务器上后无法远程查看

例如Starting TensorBoard 41 on port 6006

(You can navigate to http://127.0.1.1:6006)

解决:启动时加--host指定ip

tensorboard --host=20.5.194.73 --logdir="logs"

3)端口被占用

Error:tensorflow :Trie to connect to port 6006,but address is in use.

Tried to connect to port 6006, but address is in use.

解决: --port指定端口

tensorboard --host=20.5.194.73 --port=6099 --logdir="logs"

 

你可能感兴趣的:(python人工智能进阶篇)