smooth_l1_loss

dragon.losses.smooth_l1_loss(
  inputs,
  beta=1.0,
  reduction='mean',
  **kwargs
)[source]

Compute the element-wise error transited from L1 and L2. [Girshick, 2015].

The SmoothL1Loss function is defined as:

\[\text{SmoothL1Loss}(x, y) = \begin{cases} 0.5 * (x - y)^{2} / beta, & \text{ if } |x - y| < beta \\ |x - y| - 0.5 * beta, & \text{ otherwise } \end{cases} \]
Parameters:
  • inputs (Sequence[dragon.Tensor]) – The tensor logit and target.
  • beta (float, optional, default=1.) – The transition point from L1 to L2 loss
  • reduction ({'none', 'sum', 'mean'}, optional) – The reduction method.
Returns:

dragon.Tensor – The output tensor.