I am trying to understand what “shares storage means”. Does that mean if I detach a tensor from it’s original but then opt.step()
to modify the original, then Both would change?
i.e.
a = torch.tensor([1,2,3.], requires_grad=True)
b = a.detach()
opt = optim.Adam(a,lr=0.01)
a.backward()
opt.step() # changes both because they share storage?
So both change because they share storage? That seems an odd semantics to have or I am missing the point of .detach()
.
here is the migration guide Richard mentioned:
Related useful links: