qumphy.models.utils.kgloss module
- class qumphy.models.utils.kgloss.KGLoss(*args: Any, **kwargs: Any)[source]
Bases:
ModuleEquation 12 from https://arxiv.org/abs/1703.04977 Models aleatoric uncertainty for classification tasks
- forward(logits, noise, target)[source]
Compute the loss for aleatoric uncertainty.
- Parameters:
logits (torch.Tensor) – The output of the model before softmax
noise (torch.Tensor) – The output of the model for the aleatoric uncertainty
target (torch.Tensor) – The target of the model
- Returns:
loss – The loss of the model
- Return type:
torch.Tensor
- class qumphy.models.utils.kgloss.KGLoss_unified_prediction(*args: Any, **kwargs: Any)[source]
Bases:
KGLossEquation 12 from https://arxiv.org/abs/1703.04977 Models aleatoric uncertainty for classification tasks
- forward(prediction, target)[source]
Compute the loss for aleatoric uncertainty.
- Parameters:
logits (torch.Tensor) – The output of the model before softmax
noise (torch.Tensor) – The output of the model for the aleatoric uncertainty
target (torch.Tensor) – The target of the model
- Returns:
loss – The loss of the model
- Return type:
torch.Tensor