What is the difference between require_grad and requires_grad? I am trying to freeze layers of the network. But during the implementation of the freeze function, I used require_grad = False for freezing layers, and now when I am checking it with requires_grad it says layers are not frozen i.e. result in requires_grad=True? Is there any fundamental difference between the two implementations?
model.freeze()
for name,param in model.named_parameters():
print(name,param.requires_grad)
Code of model.freeze():
def freeze(self):
# To freeze the residual layers
for param in self.network.parameters():
param.require_grad = False
for param in self.network.fc.parameters():
param.require_grad = True