Loss Functions#
Classes#
- class BaseLoss(loss_func, *args, **kwargs)[source]#
Bases:
ModuleA base class for loss functions.
This class is used to add all loss function classes to the list of safe PyTorch classes when loading saved architectures.
- Parameters:
- loss_func
type Loss function class to be used
- *args
Optional arguments to be passed to loss_func
- **kwargs
Optional keyword arguments to be passed to loss_func
- loss_func
- class GeneralLoss(loss_func, *args, **kwargs)[source]#
Bases:
BaseLossA general loss function that can be used with any torch.nn loss function class.
- Parameters:
- loss_func
str Loss function name from torch.nn
- *args
Optional arguments to be passed to loss_func
- **kwargs
Optional keyword arguments to be passed to loss_func
- loss_func
- class CrossEntropyLoss(*args, **kwargs)[source]#
Bases:
GeneralLossCross entropy loss function.
- Parameters:
- *args
Optional arguments to be passed to CrossEntropyLoss
- **kwargs
Optional keyword arguments to be passed to CrossEntropyLoss
- class GaussianNLLLoss(*args, dim=1, **kwargs)[source]#
Bases:
GeneralLossGaussian negative log likelihood loss function.
- Parameters:
- dim
int,Optional Dimension of the target that contains the mean and uncertainty, default = 1
- *args
Optional arguments to be passed to GaussianNLLLoss
- **kwargs
Optional keyword arguments to be passed to GaussianNLLLoss
- dim
- class MSELoss(*args, **kwargs)[source]#
Bases:
GeneralLossMean Squared Error (MSE) loss function.
- Parameters:
- *args
Optional arguments to be passed to MSELoss
- **kwargs
Optional keyword arguments to be passed to MSELoss