I created a simple Linear Regression using PyTorch (version 1.11)
My question is :
is not the statement “w -= lr * w.grad” same as “w = w - lr * w.grad”
Then why in one case my program passes, in the other case, it fails.
It fails when my code has:
with torch.no_grad():
w = w - lr * w.grad
print(w)
tensor(0.3000)
But it works fine when I change the line as::
with torch.no_grad():
w -= lr * w.grad
print(w)
tensor(2.0000, requires_grad=True)
In [19]: torch.version
Out[19]: ‘1.11.0’
I already filed a bug which is closed now. Bug number #74158
I think this is a valid bug, though a minor one.
Please comment. Thank you for your help.