RuntimeError: expected scalar type Double but found Float

This error might be raised, if your model parameters are in float32 while the input is in float64.
Based on your code snippet you are indeed passing the input as DoubleTensors (float64) so you would need to make sure the model parameter have the same dtype via model.double().
Alternatively, you could also cast the input to FloatTensors via input = input.float().

2 Likes