title: RuntimeError: "exp" not implemented for 'torch.LongTensor'
body: <p>I am following this tutorial: <a href="http://nlp.seas.harvard.edu/2018/04/03/attention.html" rel="noreferrer">http://nlp.seas.harvard.edu/2018/04/03/attention.html</a>
  to implement the Transformer model from the "Attention Is All You Need" paper. </p>
  
  <p>However I am getting the following error : 
  RuntimeError: "exp" not implemented for 'torch.LongTensor'</p>
  
  <p>This is the line, in the PositionalEnconding class, that is causing the error:</p>
  
  <pre><code>div_term = torch.exp(torch.arange(0, d_model, 2) * -(math.log(10000.0) / d_model))
  </code></pre>
  
  <p>When it is being constructed here: </p>
  
  <pre><code>pe = PositionalEncoding(20, 0)
  </code></pre>
  
  <p>Any ideas?? I've already tried converting this to perhaps a Tensor Float type, but this has not worked.</p>
  
  <p>I've even downloaded the whole notebook with accompanying files and the error seems to persist in the original tutorial.</p>
  
  <p>Any ideas what may be causing this error? </p>
  
  <p>Thanks!</p>