Hello Ahmed!



 A_A:

2. For loops:
The second way of using for loops is also viable but I have to see if there are much performance drop (I do not need backpropagation anyway).


Since you don’t need your weighted cumulative sum for
backpropagation, I assume that you are using it for neither
training nor inference.
As such, any loss of performance shouldn’t matter much to
your overall workflow, so I wouldn’t worry about it.
Good luck!
K. Frank