Search code examples
tensorflowneural-networkrecurrent-neural-networkloss-functionsampled-softmax

Loss function in tf.nn.sampled_softmax_loss


I have a question regarding Tensorflow:

Which loss function is used in tf.nn.sampled_softmax_loss?

I believe it's cross-entropy, but it is not written on the official website. Can anyone confirm my guess?


Solution

  • Based on this other question, it looks like it is cross entropy.

    Besides, the main difference between sampled_softmax_loss and softmax_cross_entropy_with_logits (the standard cross_entropy loss in TF) is that the first only takes into account a subset V of your vocabulary to calculate your loss, while the second takes into account your entire vocabulary.