Error

[Error] Pytorch RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CUDAType instead

HUR129 2022. 1. 31. 16:05

문제상황

: 모델이나 데이터가 일부는 cpu에, 일부는 gpu에 올라가있어서 연산이 안되는 문제

 

출력

Pytorch RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CUDAType instead

 

해결방법

: cuda에 모델 혹은 데이터를 잘 올렸는지 모델/데이터를 다 확인한다. 

.cuda()를 통해 처리할 수 있는데 이게 가끔 tensor들을 덜올리고 처리하는 경우 (꼼꼼하지 못하면 굉장히 자주) 발생하게 된다...