Function autograd::ops::softmax_cross_entropy [] [src]

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

Computes categorical_cross_entropy(softmax(y), t).

This function is better than that combination in that it can prevent underflow of log(softmax).

Arguments

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

Returns

Loss tensor with shape (batch_size, 1)