How to stop updating the parameters of a part of a layer in a CNN model (not the parameters of the whole layer)?

Hi Monkey!

If your “ten parameters” are separate Tensors (or Tensors wrapped
in Parameters), set the requires_grad property of the five you wish
to keep unchanged to False (and don’t add them to your optimizer).

If your “ten parameters” are all values in the same Tensor, the best
approach, in my mind, is to store the values before the optimizer update
and then, after the update, restore the values you wish to keep unchanged.

This approach is outlined in the following post:

Best.

K. Frank