mlx.nn.losses.l1_loss

目錄

mlx.nn.losses.l1_loss#

class l1_loss(predictions: array, targets: array, reduction: Literal['none', 'mean', 'sum'] = 'mean')#

計算 L1 損失。

參數:
  • 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'.

回傳:

The computed L1 loss.

回傳型別:

array