Solved by Nilesh_Pandey1 in post #10 
              
              
                Yes, CPU memory. 
 
 






This with the @ptrblck response made me understand what are the reasons for potential memory leak in pytorch. I will suggest read thru the links I have posted.