If I want to freeze all layers except the last one is this correct to write:
for parameter in Net_k.parameters():
parameter.requires_grad = False
for parameter in Net_k[-1].parameters():
parameter.requires_grad = True