1

张量流中有很多损失函数,如 sigmoid_cross_entropy_logits、softmax_cross_entropy_logits。你能写出这些函数的数学公式吗?什么是logits?是指这个功能吗?它是明智地应用元素吗?

4

1 回答 1

0

请看这个例子:

# tf.nn.softmax computes softmax activations
# softmax = exp(logits) / reduce_sum(exp(logits), dim)
logits = tf.matmul(X, W) + b
hypothesis = tf.nn.softmax(logits)

# Cross entropy cost/loss
loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits,
                                             labels=Y_one_hot))

logit 是模型的输出(在 softmax 之前)。您可以在https://github.com/hunkim/DeepLearningZeroToAll/blob/master/lab-06-2-softmax_zoo_classifier.py找到完整的示例。

于 2017-03-16T04:28:45.320 回答