Solved by albanD in post #2 
              
              
                You can do exactly what you did here and reuse x2 in another computation. 
A graph is kept only as long as something can reference it. 
x1 = torch.randn(10, requires_grad=True)
x2 = x1 ** 2.
# Let call Graph 1 the part of the graph that give x2
y1 = torch.randn(10, requires_grad=True)
y2 = y1 + 1.
#…