Zha*_*hao 12 tensorflow tensorboard
我试图在张量板中可视化张量总结.但是我无法在董事会中看到张量概要.这是我的代码:
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)
Run Code Online (Sandbox Code Playgroud)
其中out是多维张量.我想我的代码一定有问题.可能我tensor_summary错误地使用了这个功能.
您要做的是创建摘要操作,但是您不会调用它,也不会编写摘要(请参阅文档)。要实际创建摘要,您需要执行以下操作:
# 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)
Run Code Online (Sandbox Code Playgroud)
仅当您没有像Supervisor这样的高级助手时,才需要明确编写摘要(最后两行)。否则,您调用
sv.summary_computed(sess, summary_str)
Run Code Online (Sandbox Code Playgroud)
主管会处理。
有关更多信息,另请参见: 如何手动创建tf.Summary()
希望有一种解决方法可以实现您想要的。..
如果你想查看张量值,你可以使用 as_string 转换它们,然后使用 summary.text。这些值将出现在张量板文本选项卡中。
没有尝试使用 3D 张量,但可以根据需要随意切片。
代码片段,其中包括使用插入打印语句来获取控制台输出。
predictions = tf.argmax(reshaped_logits, 1)
txtPredictions = tf.Print(tf.as_string(predictions),[tf.as_string(predictions)], message='predictions', name='txtPredictions')
txtPredictions_op = tf.summary.text('predictions', txtPredictions)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7570 次 |
| 最近记录: |