Cek your input. I think your input in form of Float Tensor. I always have same problem for the first time. Sometimes we convert from numpy give different tensor type. Anyway just for the shortcut, if your model wants Byte tensor, just cast your input tensor to byte tensor. For example your input tensor name is input , so you can use input.type(torch.ByteTensor) it will automatically convert your float tensor to byte tensor.