class A(nn.Module):
    def __init__(self):
        super(A,self).__init__()
        self.p = nn.Parameter(torch.randn(1))

In def forward when I call print(self.p.shape, self.p), it is returning :
torch.Size([0]) Parameter containing:
tensor([], requires_grad=True)

So, self.p is not initialized. How to initialize this ? Please help.