# mlx.nn.losses.l1_loss — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.nn.losses.l1_loss

class mlx.nn.losses.l1_loss(predictions: array, targets: array, reduction: str = 'mean')

  Computes the L1 loss.

  Parameters:

    - predictions (array) – The predicted values.

    - targets (array) – The target values.

    - reduction (str , optional) – Specifies the reduction to apply to the output: `'none'` | `'mean'` | `'sum'`. Default: `'mean'`.

  Returns:

    The computed L1 loss.

  Return type:

    array