Skip to content

ch06 - 02_bonus_additional-experiments #168

Closed Answered by rasbt
d-kleine asked this question in Q&A
Discussion options

You must be logged in to vote

I am wondering why the code for training only the last layer works, because it only passes the code:

Oh that's simply because we first make all layers untrainable, and then we replace the last layer with nn.Linear, and nn.Linear is trainable by default. And that's because nn.Linear uses nn.Parameter, which has requires_grad=True by default.

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
12 replies
@rasbt
Comment options

@rasbt
Comment options

@d-kleine
Comment options

@rasbt
Comment options

@d-kleine
Comment options

Answer selected by rasbt
Comment options

You must be logged in to vote
1 reply
@d-kleine
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants