I tried to use with torch.no_grad() to resolve this error
def weights_init_normal(m):
    classname = m.__class__.__name__
    lr = 0.01
    if isinstance(m, nn.Conv2d) or isinstance(m, nn.Linear):
        torch.nn.init.normal_(m.weight, mean=0.0, std=0.02)
        with torch.no_grad():
            m.bias.sub_(m.bias.grad*lr)
            m.bias.grad.zero_()

got alot of error.
AttributeError: 'NoneType' object has no attribute 'sub_'
I found out my bias is NoneType.
Tried several techniques , nothing worked .
I wanted to initialize the weights of bias to zero.
Please help!!!