nn.Linear only takes FloatTensors 
  
  
    Re: my other post, which can be found here - RuntimeError: Expected object of type torch.LongTensor but found type torch.FloatTensor f or argument #2 'mat2' 
I traced the issue into the nn.functional module, and it seems like the error is thrown because the weights variable in the layer class is a FloatTensor. 
Idk if this is the right place to post this, but it appears to me that the devs could include in the docs somewhere that this is a requirement of the layer, and/or make this more clear by…
  


The problem is that nn.Linear in general doesn’t take LongTensor, it only takes FloatTensor, because it’s internal weight matrix, ‘mat2’ here, is a FloatTensor.
It would be helpful if this type of thing were caught at a higher level so that the error message was clear and helpful instead of allowing an error from a lower level function to propagate up.