Python wrappers
Public Python APIs implemented by this engine symbol.Inclusive cumulative sum along a single axis, .
The output has the same shape and dtype as the input. Backward uses the reverse-cumsum trick to avoid an explicit summation: reverse the upstream gradient along the axis, take its cumsum, then reverse again.
Math
Shape
Output shape equals a.shape.
Parameters
aTensorImplPtrInput tensor of any non-scalar shape and real dtype.
axisintAxis along which to accumulate. May be negative; in that case it is interpreted as
axis + ndim.Returns
TensorImplPtrOutput tensor of the same shape and dtype as a.
Raises
ErrorIf
a is a scalar (ndim == 0) or axis is out of range.Notes
Dispatch: Accelerate strided cumsum (CPU) / MLX cumsum (GPU).
Backward is O(n) per axis-stride.