Could you check the dtype of input via print(input.type())?
I guess it might be a LongTensor and you can transform it via input = input.float().
PS: It’s better to post code directly by wrapping it into three backticks ```