![](http://ac.namu.la/20240401sac/b799d04d2922ba9bc040dd242e6552ef08f8c084e1820047054830428037bcbf.jpg?expires=1719795600&key=lk3MuS6ps91LUQeGQrFOqw)
https://www.kaggle.com/carloalbertobarbano/vgg16-transfer-learning-pytorch
VGG16 Transfer Learning - Pytorch에서 활성함수
criterion = nn.CrossEntropyLoss()를
criterion = nn.BCEWithLogitsLoss()로
바꿔보는데
ValueError: Target size (torch.Size([32])) must be the same as input size (torch.Size([32, 2])) 라는 에러가 떠서 온종일 CrossEntroptLoss문법과 BCEWithLogitsLoss문법을 봐도 모르겠어 https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html 에서는 BCEWithLogitsLoss의 input 구조가 (N,*)라고하니 (N, C) 구조인 CrossEntropyLoss를 커버칠 줄 알았는데 아니더라고 BCEWithLogitsLoss() 많이 써본 챈러들 조언이나 듀토리얼 사이트 좀 부탁할게