mlx.nn.losses.nll_loss

目錄

mlx.nn.losses.nll_loss#

class nll_loss(inputs: array, targets: array, axis: int = -1, reduction: Literal['none', 'mean', 'sum'] = 'none')#

計算負對數似然損失。

參數:
  • inputs (array) -- The predicted distribution in log space.

  • targets (array) -- The target values.

  • axis (int, optional) -- The distribution axis. Default: -1.

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

回傳:

The computed NLL loss.

回傳型別:

array