Hi,
When you use .data, you break the differentiable link between the element you add in the list and the net.
If you don’t use it, I guess you add more and more to the list and you eventually run out of memory because of all the states you keep around.
If you do want to be able to compute gradients here, you should not use .data (in general, you should never use .data actually  ). But you will have to be careful and make sure the list does not get too big to limit the memory requirements.