Freeze a set of weights of a network

how to freeze a set of weights of a network

Set their .requires_grad attribute to False.