title: Different methods for initializing embedding layer weights in Pytorch
body: <p>There seem to be two ways of initializing embedding layers in Pytorch 1.0 using an uniform distribution.</p>
  
  <p>For example you have an embedding layer:</p>
  
  <pre><code>self.in_embed = nn.Embedding(n_vocab, n_embed)
  </code></pre>
  
  <p>And you want to initialize its weights with an uniform distribution. The first way you can get this done is:</p>
  
  <pre><code>self.in_embed.weight.data.uniform_(-1, 1)
  </code></pre>
  
  <p>And another one would be:</p>
  
  <pre><code>nn.init.uniform_(self.in_embed.weight, -1.0, 1.0)
  </code></pre>
  
  <p>My question is: what is the difference between the first and second initialization form. Do both methods do the same thing?</p>