2017-02-21 38 views
1

如何查看使用Tensorboard由TensorFlow生成的圖形?誰能提供一個簡單的例子?我對tensorflow很陌生。我也使用python。使用張量板的圖形

在此先感謝!

回答

2

您需要創建一個tf.summary.FileWriter,將圖形寫入TensorBoard日誌。例如:

summary_writer = tf.summary.FileWriter('logs', graph=tf.get_default_graph()) 
summary_writer.flush() 

,然後啓動tensorboard用適當的--logdir參數。

+1

,然後在本地主機打開瀏覽器:6006,然後單擊圖形選項卡上:) – fabrizioM

0

所有你需要創建計算圖表

import tensorflow as tf 

a = tf.constant(3) 
b = tf.constant(4) 

c = a+b 

with tf.Session() as sess: 
    File_Writer = tf.summary.FileWriter('/home/theredcap/Documents/CS/Personal/Projects/Test/tensorflow/tensorboard/' , sess.graph) 
    print(sess.run(c)) 

這裏tf.summary.FileWriter(' path to store your logs')首先寫入圖形到Tensorflow登錄

然後,所有你需要做的是與所提到的日誌訪問tensorboard /圖中,你只是

tensorboard --logdir "path/to/logs" 

報告中寫道:當我做

tensorboard --logdir = "the above mentioned path" 

什麼都沒有顯示在我的tensorboard

欲瞭解更多信息

https://github.com/tensorflow/tensorboard/blob/master/README.md