我创建了一个TensorFlow模型,但是总是因为某些原因获得NAN损失。我想知道如何调试并查看每个张量中的每个值。
例如:
out = tf.add(tf.matmul(outputs[-1], _weights['out']), _biases['out'])
在运行时,我希望查看此张量中的值,并了解出现问题的原因。
我在这篇文章中找到了类似的内容。
他们做了类似于以下的操作:
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...]
这并不是非常有用,因为我无法查看所有的值。 我想知道是否有逐步调试选项?