Hi all,
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 False for param.requires_grad. I get True however.
So what’s the difference between model.train(False) and:
for param in self.parameters():
     param.requires_grad = False

?
What are the best practices when trying to initialize a model and freeze weights?
Thanks!