How to fix RuntimeError “Expected object of scalar type Float but got scalar type Double for argument”?

后端 未结 4 1155
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 11:55

I\'m trying to train a classifier via PyTorch. However, I am experiencing problems with training when I feed the model with training data. I get this error on y_pred =

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 12:18

    The issue can be fixed by setting the datatype of input to Double i.e torch.float32

    I hope the issue came because your datatype is torch.float16

提交回复
热议问题