【发布时间】:2016-05-16 10:33:08
【问题描述】:
在tensorflow中,有称为softmax_cross_entropy_with_logits和sampled_softmax_loss的方法。
我阅读了 tensorflow 文档并在 google 上搜索了更多信息,但我找不到不同之处。在我看来,两者都使用 softmax 函数计算损失。
使用sampled_softmax_loss计算损失
loss = tf.reduce_mean(tf.nn.sampled_softmax_loss(...))
使用softmax_cross_entropy_with_logits计算损失
loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(P, Q))
对我来说,计算 softmax 损失与计算 softmaxed 交叉熵相同(例如 cross_entropy(softmax(train_x)))
谁能告诉我为什么有两种不同的方法,在哪种情况下我应该使用哪种方法?
【问题讨论】:
标签: python machine-learning deep-learning tensorflow