Compute the cumulative sum of a 1D tensor.
The cumulative sum at position i is the sum of all elements from index 0 to i (inclusive).
Input: A 1D tensor x of shape (n,).
Output: A 1D tensor of shape (n,) where element i is sum(x[0:i+1]).
API Reference:
torch.cumsum(x, dim=0) jnp.cumsum(x)