Tensorboard错误:' Tensor'对象没有属性' value'

时间:2017-10-31 08:13:19

标签: python tensorflow tensorboard

我的目标:将任意文本添加到tensorboard。

我的代码:

text = "muh teeeext"
summary = tf.summary.text("Muh taaaag", tf.convert_to_tensor(text))
writer.add_summary(summary)

我的错误:

  File xxx, line xxx, in xxx
    writer.add_summary(summary)
  File "/home/xxx/.local/lib/python3.5/site-packages/tensorflow/python/summary/writer/writer.py", line 123, in add_summary
    for value in summary.value:
AttributeError: 'Tensor' object has no attribute 'value'

1 个答案:

答案 0 :(得分:5)

writer.add_summary(summary)是张量。 tensorboard writer需要一个字符串作为摘要。要从张量中获取摘要,请将eval()添加到add_summary行,如下所示:

writer.add_summary(summary).eval()