peal.training.criterions.cross_entropy_loss

peal.training.criterions.cross_entropy_loss(input, target, size_average=True, latent_code=None)[source]

Cross-entropy between logits and a soft (one-hot or mixed) target.

Parameters:
  • input (torch.Tensor) – Logits of shape [N, C]; log-softmax is applied here.

  • target (torch.Tensor) – Target distribution of the same shape (one-hot or a mixup of them).

  • size_average (bool, optional) – Divide the summed loss by the batch size N (default) or return the plain sum.

  • latent_code (optional) – Ignored; present for the common criterion signature.

Returns:

Scalar loss.

Return type:

torch.Tensor