mlx.core.diff

Contents

mlx.core.diff#

diff(a: array, /, n: int = 1, axis: int = -1, *, stream: None | Stream | Device = None) array#

The n-th discrete difference along the given axis.

Parameters:
  • a (array) – Input array.

  • n (int, optional) – The number of times to difference. Default: 1.

  • axis (int, optional) – The axis along which to difference. Default: -1.

Returns:

The n-th differences.

Return type:

array