How to manually create text summaries in TensorFlow?

女生的网名这么多〃 提交于 2019-12-11 17:43:51

问题


First of all, I already know how to manually add float or image summaries. I can construct a tf.Summary protobuf manually. But what about text summaries? I look at the definition for summary protobuf here, but I don't find a "string" value option there.


回答1:


TensorBoard's text plugin offers a pb method that lets you create text summaries outside of a TensorFlow environment. https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/text/summary.py#L74

Example usage:

import tensorboard as tb
text_summary_proto = tb.summary.pb('fooTag', 'text data')



回答2:


John Hoffman's answer is great, though the tb.summary.pb API seems not available as of TF 1.x. You can instead use the following APIs:

tb.summary.text_pb("key", "content of the text data")

Just FYI, tb.summary has many similar methods for other types of summary as well:

'audio', audio_pb',
'custom_scalar', 'custom_scalar_pb',
'histogram', 'histogram_pb',
'image', 'image_pb',
'pr_curve', 'pr_curve_pb',
'pr_curve_raw_data_op',
'pr_curve_raw_data_pb',
'pr_curve_streaming_op',
'scalar', 'scalar_pb',
'text', 'text_pb'


来源:https://stackoverflow.com/questions/47841405/how-to-manually-create-text-summaries-in-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!