我制作了一个张量流模型.
但由于某种原因,总会得到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