open3d.ml.torch.modules.losses.SmoothL1Loss#

class open3d.ml.torch.modules.losses.SmoothL1Loss(beta=1.0, loss_weight=1.0)#

Smooth L1 loss.

Parameters:
  • beta (float, optional) – The threshold in the piecewise function. Defaults to 1.0.

  • reduction (str, optional) – The method to reduce the loss. Options are “none”, “mean” and “sum”. Defaults to “mean”.

  • loss_weight (float, optional) – The weight of loss.

__init__(beta=1.0, loss_weight=1.0)#

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(pred, target, weight=None, avg_factor=None, **kwargs)#

Forward function.

Parameters:
  • pred (torch.Tensor) – The prediction.

  • target (torch.Tensor) – The learning target of the prediction.

  • weight (torch.Tensor, optional) – The weight of loss for each prediction. Defaults to None.

  • avg_factor (int, optional) – Average factor that is used to average the loss. Defaults to None.

  • reduction_override (str, optional) – The reduction method used to override the original reduction method of the loss. Defaults to None.

training: bool#