You can use both, but using the optimizer is probably a better practice. This is because you may sometimes be optimizing parameters of more than one model, so, by zeroing in the optimizer, you avoid forgetting zeroing the gradients of one of the models.