I have an problem : I need to store many outputs of a network in a buffer (for reinforcement learning)
for i in range 1000:
    buffer.append(network[x])
compute mean loss of the elements in the buffer

x = [B,C,H,W] = [64,1,30,30]
network[x] is shaped like [64,1]
So the buffer contains tensor of very small dimension.
However the memory of the gpu fills up extremely fast.
I suspect that by adding the output to the buffer I am also adding all the computational graph.
So I add the graph hundreds of times and it makes my memory explode.
Do you have any solutions?
Thanks you