DistributionNLLLoss#
- class torch_uncertainty.losses.DistributionNLLLoss(reduction='mean')[source]#
Negative Log-Likelihood loss using given distributions as inputs.
- Parameters:
reduction (str, optional) – specifies the reduction to apply to the output:
'none'
|'mean'
|'sum'
. Defaults to “mean”.
- forward(dist, targets, padding_mask=None)[source]#
Compute the NLL of the targets given predicted distributions.
- Parameters:
dist (Distribution) – The predicted distributions
targets (Tensor) – The target values
padding_mask (Tensor, optional) – The padding mask. Defaults to
None.
Sets the loss to0
for padded values.