Solved by ptrblck in post #2 
              
              
                The memory is increasing as each forward pass creates intermediate variables, which are used to calculate the gradients. So it shouldn’t be a memory leak. 
If you just need the features without backpropagating through your model, you should wrap your code in with torch.no_grad(): to avoid storing th…