credit.losses.downscaling_loss#
Attributes#
Classes#
Custom loss function for downscaling. |
Module Contents#
- credit.losses.downscaling_loss.logger#
- class credit.losses.downscaling_loss.DownscalingLoss(conf, validation=False)#
Bases:
torch.nn.ModuleCustom loss function for downscaling.
- Parameters:
conf (dict) – configuration dictionary containing loss function settings and weights.
validation (bool, optional) – whether loss function is in validation mode. Defaults to False.
- training_loss#
- use_power_loss#
- use_spectral_loss#
- spectral_lambda_reg#
- spectral_wavenum_init#
- validation = False#
- forward(target, pred)#
Calculate the total loss for the given target and prediction.
This method computes the base loss between the target and prediction, applies optional variable weights, and optionally adds spectral and power loss components.
- Parameters:
target (torch.Tensor) – Ground truth tensor.
pred (torch.Tensor) – Predicted tensor.
- Returns:
The computed loss value.
- Return type:
torch.Tensor