如何在TensorFlow摘要中添加任意值? [英] How do I add an arbitrary value to a TensorFlow summary?

查看:151
本文介绍了如何在TensorFlow摘要中添加任意值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了将一个简单值val记录到TensorBoard摘要中,我需要

In order to log a simple value val to a TensorBoard summary I need to

val = 5
test_writer.add_summary(sess.run(tf.scalar_summary('test', val)), global_step)

sess.run(tf.scalar_summary('test', val))

真的有必要添加val作为摘要吗?

really necessary to get val added as a summary?

推荐答案

您可以自己构建摘要,例如

You can construct the summary by yourself, like

from tensorflow.core.framework import summary_pb2

value = summary_pb2.Summary.Value(tag="Accuracy", simple_value=0.95)
summary = summary_pb2.Summary(value=[value])

然后您可以像在代码中一样使用add_summary添加summary.

you can then add summary using add_summary like in your code.

这篇关于如何在TensorFlow摘要中添加任意值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆