RuntimeError: leaf variable has been moved into the graph interior
I try to use pytorch for autogradient. When I'm testing is, I met the error. My code is as below:

w11 = torch.rand((100,2), requires_grad=True)
w12 = torch.rand((100,2), requires_grad=True)
w12[:,1] = w12[:,1] + 1
w13 = torch.rand((100,2), requires_grad=True)
w13[:,1] = w13[:,1] + 2
out1=(w11-w12)**2
out2=out1.mean()
out2.backward(retain_graph=True)


Use with torch.no_grad() when you want to replace something in tensors with requires_grad=True, 

w11 = torch.rand((100,2), requires_grad=True)
w12 = torch.rand((100,2), requires_grad=True)
w13 = torch.rand((100,2), requires_grad=True)
with torch.no_grad():
  w12[:,1] = w12[:,1] + 1
  w13[:,1] = w13[:,1] + 2
out1=(w11-w12)**2
out2=out1.mean()
out2.backward(retain_graph=True)


All will go well.
