cumsum

dragon.vm.torch.cumsum(
  input,
  dim,
  out=None
)[source]

Compute the cumulative sum of elements along the given dimension.

dim could be negative:

# A negative dimension is the last-k dimension
x = torch.tensor([[1, 2, 3], [4, 5, 6]])
print(torch.cumsum(x, dim=1))  # [[1, 3, 6], [4, 9, 15]]
print(torch.cumsum(x, dim=-1))  # Equivalent
Parameters:
Returns:

dragon.vm.torch.Tensor The output tensor.