Function candle_nn::loss::nll

source ·
pub fn nll(inp: &Tensor, target: &Tensor) -> Result<Tensor>
Expand description

The negative log likelihood loss.

Arguments

  • [inp]: The input tensor of dimensions N, C where N is the batch size and C the number of categories. This is expected to contain log probabilities.
  • [target]: The ground truth labels as a tensor of u32 of dimension N.

The resulting tensor is a scalar containing the average value over the batch.