Well, it depends on the specific situation. For me, I add .float() to the output of the embedding layer (which was a LongTensor variable). I suggest that you can check the output of each step to see where the type problem might occur.