mlx.core.cumsum

目录

mlx.core.cumsum#

cumsum(a: array, /, axis: int | None = None, *, reverse: bool = False, inclusive: bool = True, dtype: Dtype | None = None, stream: StreamOrDevice = None) → array#

Return the cumulative sum of the elements along the given axis.

参数:
  • a (array) -- Input array.

  • axis (int, optional) -- Optional axis to compute the cumulative sum over. If unspecified the cumulative sum of the flattened array is returned.

  • reverse (bool) -- Perform the cumulative sum in reverse.

  • inclusive (bool) -- The i-th element of the output includes the i-th element of the input.

  • dtype (Dtype, optional) -- Cast the input to this type before summing.

返回:

The output array.

返回类型:

array