반응형 반응형 pytorch2 반응형 RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same 에러해결 개발환경 - ubuntu18.04 - python3.7 1. Problem RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same pytorch로 학습을 할 때 input type과 weight type이 같아야만 한다는 에러가 발생 2. Reason GPU로 학습을 할 때 model이나 dataset를 GPU에 설정하지 않았기 때문에 발생 3. Solution torch.tensor(..., device="cuda") torch.tensor(...).cuda() torch.tensor(...).to("cuda") model.to("cuda") dataset이나 model을.. 2022. 4. 5. freeze_support() error 해결 개발환경 - window10 - pytorch 1.2.0 - pycham 2020.3.3 1. Problem pytorch를 사용해서 model을 학습하려고 할 때 해당 error가 발생하였다. 2. Reason window 환경은 unix, linux와 다르게 *fork 를 지원하지 않고 *spawn을 사용한다고 하는데 spawn은 부모프로세스와 자식 프로세스가 구분되지 않아 프로세스를 계속 불러오는 재귀호출이 발생한다. * fork : 부모 프로세스에서 자식 프로세스를 하나 복제 생성해 주는 역할을 한다. 이때 복제 생성시, 부모 프로세스와 같은 프로세스가 만들어짐 * spawn : 부모 프로세스는 깨끗한 새 파이썬 인터프리터 프로세스를 시작한다. 자식 프로세스는 프로세스 객체의 run() 메서드를 .. 2021. 3. 25. 이전 1 다음 반응형