I dont understand what the issue is, isn’t
    for W in mdl_sgd.parameters():
        W.data = W.data - eta*W.grad.data

what u do to loop over?
(also it seems ur title doesn’t reflect ur real question I suggest to update it, its confusing and unnecessary).