[Pytorch] RuntimeError: Found dtype Long but expected Float loss = loss_func(pred, y) loss를 계산하는 과정에서 RuntimeError: Found dtype Long but expected Float 에러가 발생했다. loss = loss_func(pred.to(torch.float32), y.to(torch.float32)) 다음과 같이 pred와 y의 tensor type을 float32로 변경해주면 된다. Python/PyTorch 공부 2021.12.18