Solved by albanD in post #12 
              
              
                The problem is that in your loop, precisions (and other) are both used and written to. 
This means that the next iteration depends on the operations from the previous iteration (and thus all the ones before). 
If you only want backprop to compute gradients for the current iteration, you want to do s…