Let’s say we have a network made of 5 layers:
input = torch.nn.Linear()
layer2 = torch.nn.Linear()
layer3 = ...
layer4 = ...
output = torch.nn.Linear(.., 2)

I want to train the network with all 5 layers, as usual, for about 10 epochs, then I want to train just the last 3 layers (layer 3, layer 4 and output). How can I tell pytorch to stop updating the weights of input and layer 1? Could someone provide a very simple, but working, example?