Solved by albanD in post #5 
              
              
                Hi, 
What this error means is that some part of the graph is shared between iteration. This is most likely due to the fact that you pre-compute something outside of the for loop and re-use it at each iteration inside. 
If you want gradients flowing throw these computations, you should move them insi…