mlx.nn.losses.huber_loss#
- class huber_loss(inputs: array, targets: array, delta: float = 1.0, reduction: Literal['none', 'mean', 'sum'] = 'none')#
Computes the Huber loss between inputs and targets.
\[\begin{split}l_{\delta}(a) = \left\{ \begin{array}{ll} \frac{1}{2} a^2 & \text{for } |a| \leq \delta, \\ \delta \left( |a| - \frac{1}{2} \delta \right) & \text{otherwise.} \end{array} \right.\end{split}\]- Parameters:
- Returns:
The computed Huber loss.
- Return type: