title: Adding xavier initiliazation in pytorch
body: <p><strong>I want to add Xavier initialization to the first layer of my Neural Network, but I am getting an error in this class:</strong></p>
  <pre><code>class DemoNN(nn.Module):
      def __init__(self):
          super().__init__()
          torch.manual_seed(0)
          self.net = nn.Sequential(
              nn.Linear(2,2),
              torch.nn.init.xavier_uniform((nn.Linear(2,2)).weights),
              nn.Sigmoid(),
  
              nn.Linear(2,2),
              nn.Sigmoid(),
  
              nn.Linear(2,4),
              nn.Softmax()
              )
      
      def forward(self, X):
          self.net(X)
  </code></pre>