Model.zero_grad() or optimizer.zero_grad()?

If you’re referring to:

optimizer = optim.SGD(net.parameters())

They’re the same.