Require_grad vs requires_grad

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?

for name,param in model.named_parameters():

Code of model.freeze():

def freeze(self):
        # To freeze the residual layers
        for param in
            param.require_grad = False
        for param in
            param.require_grad = True


require_grad is not a pytorch thing :slight_smile: So it has no effect.
Note that you can set any attribute you want on Tensor, this is why you didn’t see any error ( = 3 would work as well).