If you check out the optimizers’ source codes, you see that you need to have p.grad for each model parameter p.
So a starting point can be something like
l.weight.grad = torch.zeros_like(l.weight)

Best regards
Thomas