Solved by albanD in post #9 
              
              
                I think my comment above is relevant: 

Here, the input to your model, data is the same Tensor as input that you get during forward. But even if you don’t store input, you still hold onto data in your training loop, so it cannot be freed. 
Changing to 
output = mode(data)
del data

should help. 
Als…