知道如何启动tensorboard后,就该了解一下怎么使用它。
1. 运行python示例,test.py
import tensorflow as tf
with tf.name_scope('graph') as scope:
matrix1 = tf.constant([[3., 3.]],name ='matrix1') #1 row by 2 column
matrix2 = tf.constant([[2.],[2.]],name ='matrix2') # 2 row by 1 column
product = tf.matmul(matrix1, matrix2,name='product')
sess = tf.Session()
writer = tf.summary.FileWriter("logs/", sess.graph)
init = tf.global_variables_initializer()
sess.run(init)
2. 启动tensorboard
>tensorboard --logdir=d:\develop\python\ex\logs
注:这里logdir的值和第一步logs/的路径是同一个
3. 用浏览器访问http://192.168.x.x:6006,打开GRAPH菜单如下: