【问题标题】:in tensorflow MNIST softmax tutorial, softmax function is not used在tensorflow MNIST softmax教程中,没有使用softmax函数
【发布时间】:2016-12-27 07:27:36
【问题描述】:

我正在关注 MNIST Softmax 教程https://www.tensorflow.org/tutorials/mnist/beginners/

后面是文档,模型应该是

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 值。但这会给开发者带来一些困惑。

对此有什么想法?

【问题讨论】:

    标签: tensorflow softmax


    【解决方案1】:

    使用了 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_))
    

    更多详情请见softmax_cross_entropy_with_logits

    【讨论】:

      猜你喜欢
      • 2017-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多