Function autograd::ops::sparse_softmax_cross_entropy [] [src]

pub fn sparse_softmax_cross_entropy(y: &Tensor, t: &Tensor) -> Tensor

A variant of softmax_cross_entropy.

The behavior of this function is same as softmax_cross_entropy except that t is not batch of one-hot distributions but batch of ground truth label ids.

Arguments

  • y - Tensor with shape (batch_size, num_classes)
  • t - Tensor with shape (batch_size,) or (batch_size, 1)

Returns

Loss tensor with shape (batch_size, 1)