diffengine.models.losses.hubar_loss¶
Module Contents¶
Classes¶
Huber loss. |
- class diffengine.models.losses.hubar_loss.HuberLoss(delta=1.0, loss_weight=1.0, reduction='mean', loss_name='l2')[source]¶
Bases:
diffengine.models.losses.base.BaseLossHuber loss.
Args:¶
- delta (float, optional): Specifies the threshold at which to change
between delta-scaled L1 and L2 loss. The value must be positive. Default: 1.0
- loss_weight (float, optional): Weight of this loss item.
Defaults to
1..- reduction: (str): The reduction method for the loss.
Defaults to ‘mean’.
- loss_name (str, optional): Name of the loss item. If you want this loss
item to be included into the backward graph, loss_ must be the prefix of the name. Defaults to ‘l2’.
- forward(pred, gt, weight=None)[source]¶
Forward function.
Args:¶
pred (torch.Tensor): The predicted tensor. gt (torch.Tensor): The ground truth tensor. weight (torch.Tensor | None, optional): The loss weight.
Defaults to None.
Returns:¶
torch.Tensor: loss
- Parameters:
pred (torch.Tensor) –
gt (torch.Tensor) –
weight (torch.Tensor | None) –
- Return type:
torch.Tensor
- Parameters:
delta (float) –
loss_weight (float) –
reduction (str) –
loss_name (str) –