I have a LSTM model where I first have to cast the data in float-tensor because pre-processed data is long. And since the problem is a classification one so I use cross-entropy loss function. But cross-entropy does not take float-tensor so I once again need to cast in long-tensor. But then I have
log_softmax_forward is not implemented for type torch.LongTensor

Why is it so difficult. Why does the framework not convert to requisite type since all the three types are same except in how much memory they are stored?
Code:
output = train_model(Variable(x.float())) # train_model is LSTM and LL model
# Expected object of type Variable[torch.FloatTensor] but 
# found type Variable[torch.DoubleTensor] for argument #1 'mat1'. So has to cast to float.

loss = loss_func(output.long(), Variable(y)) # Loss function is cross-entropy loss function.
# Expected object of type Variable[torch.LongTensor] but found type 
# Variable[torch.DoubleTensor] for argument #1 'target'. So I cast to long.

# log_softmax_forward is not implemented for type torch.LongTensor

How do I fix this? I don’t like this converting part. Moreover, even after that, I get an error. Where can I read more about it to understand well.