Setting weights

In PyTorch is there a way to specifically freeze only certain weights in a linear layer during the training process? Basically, I want to assign and maintain some weights in a linear layer to be zero. I am not able to figure out as to how to do this. Any help/input will be greatly appreciated.


This topic might be helpful.

Thank you! I am going through it.
I also had a question that is it possible to prune a network first using Pytorch pruning functionality and then train the pruned network?