즐거운 에러 대잔치

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

나 왜 인공지능전공 2023. 10. 17. 00:42
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

에러를 읽어보자

 

인풋 데이터의 타입은 cuda에 올라가 있는데, weight는 cuda에 안올라가 있네?

 

이거 두개를 맞춰줘야 한다.

 

GPU를 사용한다면 model 과 dataset을 to("cuda")를 써서 GPU로 올리자.

GPU를 사용안한다면 그냥 하면 되지 않을까