这是我实现的在张量板上绘制数组的代码:
import tensorflow as tf
a = [100, 80, 50, 40, 30, 15, 10, 7, 5, 9, 3, 1]
writer = tf.summary.FileWriter('./log')
summary = tf.Summary()
for i in range (0, len(a)):
summary.value.add(tag='x', simple_value=a[i])
writer.add_summary(summary, i)
writer.flush()
writer.close()
我得到一个这样的情节:Tensorbaord plot
我想要类似蓝线的东西,但我却得到了橙色线。请帮助我发现我的代码中的错误,并说明这种行为的原因吗?谢谢。
答案 0 :(得分:0)
那是因为您要一次又一次地将相同的值添加到摘要中。相反,您可以
import tensorflow as tf
a = [100, 80, 50, 40, 30, 15, 10, 7, 5, 9, 3, 1]
writer = tf.summary.FileWriter('./log')
for i in range (0, len(a)):
summary = tf.Summary()
summary.value.add(tag='x', simple_value=a[i])
writer.add_summary(summary, i)
writer.close()