Solved by albanD in post #2 
              
              
                Hi, 
This package will return a dot graph: https://github.com/szagoruyko/pytorchviz 
The objects are re-used because the first one goes out of scope and is free. But later one, since you redo an allocation of the same size, the same memory is returned to you (many allocator do caching for allocation…