burn
burn copied to clipboard
[Tensor] Add `cumsum` operation
Implement cumulative sum across an input dimension.
Example:
let x = Tensor::arange(0..6 as i64, &device);
x.cumsum(0)
// [ 0, 1, 3, 6, 10, 15]
cumprod
has also been asked for twice on discord:
https://discord.com/channels/1038839012602941528/1038839013735399547/1234609825619644477
https://discord.com/channels/1038839012602941528/1091796857996451942/1202670351322972302
let x = Tensor::arange(1..7 as i64, &device);
x.cumsum(0)
// [ 1, 2, 6, 24, 120, 720]