Hi Doyup!



 LeeDoYup:

However, I found that the weights of the front layers are still updated.


If you use momentum or weight_decay (both supported by SGD),
your weights can still be updated even if their gradients are zero.



Why the gradients of front layers are still computed and updated?



Have you checked that your requires_grad = False gradients are,
in fact, being calculated and given non-zero values?  Or do you just
see that the weights are being changed by optimizer.step()?
Best.
K. Frank