nn.Parameter contains nan when initializing

NaN comes from torch.Tensor, not from Parameter.
This topic is relevent and helpful for you: Nan in torch.Tensor.

If you would like to initialize with random value, then you can use torch.rand instead of torch.Tensor.