How to set the type of tensor

When I write my dataloader, I found the data were transform into DoubleTensor, However when I load some pretrained model, I found my model weights were FloatTensor, How to solve this problem

Maybe modifying your dataloader to transform the data into FloatTensor would be a way to solve your problem ?

Or this simple hack…

output = model(input.float())
2 Likes

yes, I did that, I make all the tensor into floatTensor