Cumulative sum of elements along dimension dim. If dim
is omitted, it defaults to 1 (column-wise cumulative sums).
As a special case, if x is a vector and dim is omitted,
return the cumulative sum of the elements as a vector with the
same orientation as x.