我試圖在tensorboard情節簡單,就像他們有它在主頁上,這樣的事情:獲得在Tensorboard
import tensorflow as tf
import numpy as np
x = tf.placeholder('float',name='X')
y= tf.placeholder('float',name='y')
addition = tf.add(x,y)
with tf.Session() as sess:
for i in range(100):
var1= np.random.rand()
var2= np.random.rand()
print(var1,var2)
tf.summary.scalar('addition',sess.run(addition, feed_dict={x:var1,y:var2}))
writer = tf.summary.FileWriter('Graphs',sess.graph)
雖然我可以看到圖形,但看不到任何標量值。任何人都可以向我解釋我在這裏做錯了什麼? PS:我已經運行了所有正式的例子,它們都在工作,但我需要理解這個例子才能使用它。 感謝您的幫助!
更新
後運行@ DV3代碼程序crashs。這裏是我所得到的:
InvalidArgumentError: You must feed a value for placeholder tensor 'input/x-input' with dtype float
[[Node: input/x-input = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
During handling of the above exception, another exception occurred:
InvalidArgumentError Traceback (most recent call last)
<ipython-input-5-5cbd77e71936> in <module>()
14 var2= np.random.rand()
15 print(var1,var2)
---> 16 add, s_ = sess.run([addition, summary_op], feed_dict={x:var1,y:var2})
17 writer.add_summary(s_, i)
請共享會話的整個代碼,你怎麼運行的呢? – dv3
這是整個代碼? – Engine
哦對不起,結構困惑我 - 我會發布爲什麼你看不到任何圖表.. – dv3