追記
もう少し実用的な記事を書いた
[TensorBoardのシンプルな解説]
(https://qiita.com/yabeenico/items/738d91a8f14d9430f5da)
環境
$ python3 --version
Python 3.5.4
$ pip3 list|grep tensor
tensorboard (1.0.0a6)
tensorflow (1.4.0)
tensorflow-tensorboard (0.4.0rc3)
インストール
$ pip3 install tensorflow tensorboard
サンプル
c = a + b のグラフをTensorBoardで表示
tensorboard_graph.py
import tensorflow as tf
a = tf.constant(2, name='A')
b = tf.constant(3, name='B')
c = tf.add(a, b, name='C')
sess = tf.InteractiveSession()
writer = tf.summary.FileWriter('./logdir', sess.graph)
tf.global_variables_initializer().run()
print(sess.run(c))
$ python3 tensorboard_graph.py
5
$ tensorboard --logdir='./logdir'
TensorBoard 0.4.0rc3 at http://localhost:6006 (Press CTRL+C to quit)
するとカレントディレクトリにlogdirが生成され,その中にグラフの情報が保存れる.
ブラウザで http://localhost:6006 にアクセスするとTensorBoardの画面が表示される.
TensorBoardは表示されるがグラフが表示されない場合
$ python3 tensorboard_graph.py
の前に
$ rm -rf ./logdir
を実行する.
その時tensorboardは終了しておく.