Hi,
If G is a Tensor, then G[i] =xxx is an inplace operation on G.
If you never need G as a full Tensor, you may want to make it a plain python list to avoid the inplace operation: you will change the list but no Tensor inplace and so it will work.