title: How to convert torch int64 to torch LongTensor?
body: <p>I am going through a course which uses a deprecated version of PyTorch which does not change <code>torch.int64</code> to <code>torch.LongTensor</code> as needed. The current section of code which is throwing the error is: </p>
  
  <p><code>loss = loss_fn(Ypred, Ytrain_) # calc loss on the prediction</code></p>
  
  <p>I believe the dtype should be changed in thhis section though:</p>
  
  <p><code>Ytrain_ = torch.from_numpy(y_train.values).view(1, -1)[0]</code>.</p>
  
  <p>When testing the data-type by using <code>Ytrain_.dtype</code> it returns <code>torch.int64</code>. I have tried to convert it by applying the <code>long()</code> function as such: <code>Ytrain_ = Ytrain_.long()</code> to no avail. </p>
  
  <p>I have also tried looking for it in the <a href="https://pytorch.org/docs/stable/tensor_attributes.html#tensor-attributes-doc" rel="noreferrer">documentation</a> but it seems that it says <code>torch.int64</code> OR <code>torch.long</code> which I assume means <code>torch.int64</code> should work.</p>
  
  <pre><code>RuntimeError                              Traceback (most recent call last)
  ----&gt; 9     loss = loss_fn(Ypred, Ytrain_) # calc loss on the prediction
  RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target'
  </code></pre>