I found this thread which has a similar issue:

  
    
    
    Problems with weight array of FloatTensor type in loss function 
  
  
    I have mostly worked on keras with tf backend and sometimes dabbled with torch7. I was intrigued by the pytorch project and wanted to test it out. So, I was trying to run a simple model on a dataset where I loaded my features into a np.float64 array and the target labels into a np.float64 array. Now, PyTorch automatically converted them both to DoubleTensor and that seems okay to me. However, the loss function expects Double Tensors for the Weight and the Bias but apparently it is getting Float …
  


I printed out the types for all my variables and everything is  a float. I dont know why it expects a Long tensor all of a sudden. And  I cant find any data that is of type Long.  I am stuck here, any help would be appreciated it.