I’m not getting the usage of model.train(False) and param.requires_grad(False).
It seems to me that if I execute the following:
class Test(nn.Module): def __init__(self): super(Test, self).__init__() self.build_model() self.train(False) for param in self.parameters(): print param.requires_grad exit(0)
I should get
param.requires_grad. I get
So what’s the difference between
for param in self.parameters(): param.requires_grad = False
What are the best practices when trying to initialize a model and freeze weights?