在tensorflow MNIST softmax教程中,未使用softmax函数

在tensorflow MNIST softmax教程中,未使用softmax函数,tensorflow,softmax,Tensorflow,Softmax,im下面是MNIST Softmax教程 然后是文档,模型应该是 y = tf.nn.softmax(tf.matmul(x, W) + b) 但是在示例源代码中,正如您所看到的 # Create the model x = tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.matmul(x, W) + b 未使

im下面是MNIST Softmax教程

然后是文档,模型应该是

y = tf.nn.softmax(tf.matmul(x, W) + b)
但是在示例源代码中,正如您所看到的

# Create the model
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.matmul(x, W) + b
未使用softmax。我认为这需要改变

y = tf.nn.softmax(tf.matmul(x, W) + b)
我假设,在测试函数中,它使用argmax,因此不需要将它规范化为0~1.0值。但是它会给开发者带来一些困惑


关于这一点,使用了Softmax,第57行:

# So here we use tf.nn.softmax_cross_entropy_with_logits on the raw
# outputs of 'y', and then average across the batch.
cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(y, y_))
有关更多详细信息,请参阅