fn
cumsum
→Tensorcumsum(input: Tensor, dim: DimLike = ...)Return the cumulative sum of elements along dim.
The i-th output along dim is the sum of all input values at
positions 0..i inclusive. Useful for computing running totals,
integration on discrete grids, and constructing offset/index buffers.
Parameters
inputTensorSource tensor.
dimDimLike= ...Dimension along which to accumulate.
Returns
TensorSame shape and dtype as input.
Notes
Floating-point accumulation is performed left-to-right with naive summation — for very long inputs a Kahan-compensated reduction may yield smaller error but is not used here for performance reasons.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0, 4.0])
>>> lucid.cumsum(x, dim=0)
Tensor([ 1., 3., 6., 10.])