title: Defining named parameters for a customized NN module in Pytorch
body: <p>This question is about how to appropriately define the parameters of a customized layer in Pytorch.  I am wondering how one can make the parameter to end up being <strong>named parameter</strong>?</p>
  <pre><code>class My_layer(torch.nn.Module):
      def __init__(self):
          self.mu = torch.nn.Parameter(torch.tensor([[0.0],[1.0]]))
  </code></pre>
  <p>So that when I print the parameters as below, the p.name is not empty.</p>
  <pre><code>my_layer = My_Layer()
  for p in my_layer.parameters():
       print(p.name, p.data, p.requires_grad)
  </code></pre>