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 DoubleTensor
s (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 FloatTensor
s via input = input.float()
.
2 Likes