微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何调试Tensorflow网络权重/输出/每个输入样本的成本?

我制作了一个张量流模型.
但由于某种原因,总会得到NAN损失.
我想知道如何调试和查看每个张量中的每个值.

例如: –

 out = tf.add(tf.matmul(outputs[-1], _weights['out']), _biases['out'])

在运行期间,我想查看此张量中的值,并查看出错的位置.
我在post中找到了类似的东西

他们在哪里做这样的事情

out = tf.add(tf.matmul(outputs[-1], _weights['out']), _biases['out'])
out = tf.Print(out, [out], message="This is softmax Output: ")

但是这样的放弃和放弃

I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [2.148583e-08 5.9002307e-08 -9.90654e-08...]
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]
Iter 64, Minibatch Loss= nan, Training Accuracy= 0.01562
Testing Accuracy: 0.0
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]
I tensorflow/core/kernels/logging_ops.cc:79] This is softmax Output: [nan nan nan...]

哪个不是那么有用,因为我无法查看所有值.
我想知道是否有一步一步的调试选项?

解决方法:

TensorFlow现在有一个名为tfdbg的内置调试器.它暴露了图中的中间张量以及图形结构,这样可以使您更容易调试此类问题.与print ops相比,它需要更少的代码更改并提供更好的图形覆盖率.

请查看主HEAD的文档/教程:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/how_tos/debugger/index.md

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐