i have change the update of weights and bias like this
        w=Variable((w+(alpha*(-1)*y_hat_w_grad)),requires_grad=True)
        b=Variable((b+(alpha*(-1)*y_hat_b_grad)),requires_grad=True)

the code doesn’t not show any error but i still wonder if it compute good the gradient (with these two lines


y_hat_w_grad=w.grad.data.detach().clone()
y_hat_b_grad=b.grad.data.detach().clone()


)