ELBOLoss#
- class torch_uncertainty.losses.ELBOLoss(model, inner_loss, kl_weight, num_samples, dist_family=None)[source]#
The Evidence Lower Bound (ELBO) loss for Bayesian Neural Networks.
ELBO loss for Bayesian Neural Networks. Use this loss function with the objective that you seek to minimize as
inner_loss.- Parameters:
model (
Module|None) – The Bayesian Neural Network to compute the loss forinner_loss (
Module) – The loss function to use during trainingkl_weight (
float) – The weight of the KL divergence termnum_samples (
int) – The number of samples to use for the ELBO lossdist_family (
str|None) – The distribution family to use for the output of the model.Nonemeans point-wise prediction. Defaults toNone.
Note
Set the model to
Noneif you use the ELBOLoss within the ClassificationRoutine. It will get filled automatically.