cumsum

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

Compute the cumulative sum of elements along the given dimension.

The argument dim could be negative:

x = torch.tensor([[1, 2, 3], [4, 5, 6]])

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

dragon.vm.torch.Tensor – The output tensor.