Concept

Optimizer Configuration for Frozen Parameters

When configuring the optimizer for a fine-tuning task where the base network is frozen, it is necessary to explicitly instruct the optimizer to only update the unfrozen weights. In frameworks like PyTorch, this is achieved by filtering the model's parameters and passing only those that require gradients—using a generator expression like (param for param in net.parameters() if param.requires_grad)—to the optimizer (e.g., Stochastic Gradient Descent).

0

1

Updated 2026-05-23

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L