본문 바로가기

오류 해결

[ Pytorch ] RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[3, 9,

원인
Pytorch 모델에 이미지를 그대로 넣으니 발생한 에러.
나의 경우 이미지의 크기가 (channel, batch, height, weight)이다.

해결방안
(batch, channel, height, width)로 바꿔주어야 한다.

forward에서 permute를 통해 해결