Can you please explain a.is_leaf= True as I did not use this.
How do I incorporate to my code?
Also, what do you mean by optimizer.step() ?

with torch.no_grad():
# does a.optimizer.step() replaces this line below ?
a.sub_(lr * a.grad) # w(t) = w(t-1) - lr dL/dw(t-1)
    a.grad.zero_()


Thanks.