What is the best way to check if parameters already in optimizer?

Hi,

The taken approach is complex and not necessary really.
The idea is that when you freeze a parameter using requires_grad=False, even you pass entire parameters to the optimizer, it will not consider them and literally just skip those parameters in the way that you have never provided them and this will be done by not accumulating gradients for that particular parameter which also leads to have None as the gradient.

Bests

2 Likes