如何在张量板中可视化张量摘要 [英] How to visualize a tensor summary in tensorboard

查看:35
本文介绍了如何在张量板中可视化张量摘要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在张量板中可视化张量摘要.但是我在板上根本看不到张量摘要.这是我的代码:

I'm trying to visualize a tensor summary in tensorboard. However I can't see the tensor summary at all in the board. Here is my code:

        out = tf.strided_slice(logits, begin=[self.args.uttWindowSize-1, 0], end=[-self.args.uttWindowSize+1, self.args.numClasses],
                               strides=[1, 1], name='softmax_truncated')
        tf.summary.tensor_summary('softmax_input', out)

其中 out 是一个多维张量.我想我的代码一定有问题.可能我错误地使用了 tensor_summary 函数.

where out is a multi-dimensional tensor. I guess there must be something wrong with my code. Probably I used the tensor_summary function incorrectly.

推荐答案

您所做的是创建一个摘要操作,但您不调用它,也不编写摘要(请参阅 文档).要实际创建摘要,您需要执行以下操作:

What you do is you create a summary op, but you don't invoke it and don't write the summary (see documentation). To actually create a summary you need to do the following:

# Create a summary operation
summary_op = tf.summary.tensor_summary('softmax_input', out)

# Create the summary
summary_str = sess.run(summary_op)

# Create a summary writer
writer = tf.train.SummaryWriter(...)

# Write the summary
writer.add_summary(summary_str)

只有当您没有像 主管.否则你调用

Explicitly writing a summary (last two lines) is only necessary if you don't have a higher level helper like a Supervisor. Otherwise you invoke

sv.summary_computed(sess, summary_str)

主管会处理.

更多信息,另见:如何手动创建 tf.Summary()

这篇关于如何在张量板中可视化张量摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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