I was wondering if there’s a way to do an exclusive cumsum (like that implemented with Tensorflow’s cumsum). An example of this would be,
tf.cumsum([a,b,c], exclusive=False) => [a, a+b, a+b+c] #standard cumsum
tf.cumsum([a, b, c], exclusive=True) => [0, a, a + b] #exclusive cumsum
Let’s say I have a Tensor of [1,2,3] and I take the cumsum of it. That would return a Tensor of [1,3,6]. However, if I wanted to take the “exclusive” cumsum which would be [0,1,3]? How exactly could be done efficiently? Are there plans to add this feature to PyTorch?