Training a linear classifier in the middle layers

You can freeze the first few layers. This means you will set the requires_grad parameter to False for those layers. Check this link for more information.

Hope this helps