Both will work. But there are subtle differences.
The short answer is do both: set requires_grad to False and do not give these paramaters to the optimizer.
If you only set the requires_grad field but give both to the optimizer, the weight might still be updated even though the gradient is 0 due to l2 regularization or momentum.
If you only not give it to the optimizer, then you might be doing extra computation to compute the gradients of some Tensors for which you don’t need them.