简体   繁体   中英

Tensorboard error: 'Tensor' object has no attribute 'value'

My goal: Add arbitrary text to tensorboard.

My code:

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

My error:

  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'

writer.add_summary(summary) is a tensor. the tensorboard writer expects a string for the summary. To get the summary from the tensor, add an eval() to the add_summary line like so:

writer.add_summary(summary).eval()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM