I think it is a same question as below.
if you’ll update all parameters except a few parameter you don’t want to update, it is same that you don’t update a few parameters.

  
    
    
    Updating the parameters of a few nodes in a pre-trained network during training vision
  
  
    Hi, 
I am really new to PyTorch and was wondering if there is a way to specify only a subset of neurons (of a particular layer) to update during training and freeze the rest. Say, update only 2500 nodes of the 4096 in AlexNet, FC7. param.requires_grad seems to apply to all the neurons. 
Appreciate your inputs.