Solved by soulitzer in post #2 
              
              
                There is no way to manually “destroy” the graph. It will be freed automatically once all references to it are gone. If you wish to obtain a tensor with the value of the output, but no longer attached to this graph, you can use detach