Thanks for your reply Jerly!
I exactly did the same as you did. But I don’t know what is the problem. i share part of my code here.
    # Normalizing the weight tensor
    SD = MyResnet2.state_dict(self)
    W2 = SD['linear2.weight'].clone()
    norm_W2 = W2.norm(p=2,dim=1, keepdim=True)
    normalized_W2 = W2.div(norm_W2.expand_as(W2))
    
    # Replacing the Normalized weights with previous ones
    MyResnet2.state_dict(self)['linear2.weight'] = torch.nn.Parameter(normalized_W2)
    SD = MyResnet2.state_dict(self)
    W3 = SD['linear2.weight']
    Residue = normalized_W2 - W3 # This must be zero tensor
    print(Residue)

And Residue is non-zero!