please refer to : https://pytorch.org/tutorials/beginner/finetuning_torchvision_models_tutorial.html 118
Everything remains the same, except that you actually selectively switch on / off the layers from the pretrained model whose gradients are to be considered in the backward pass.
Try to code it up and see for yourself, you don’t need to manually specify for a particular layer to be used by your optimizer, everything is taken care off by PyTorch.