728x90
inceptionv3 모델을 불러와 전이학습을 시켰더니 train 하자마자 다음과 같은 에러가 발생했다.
TypeError: max() received an invalid combination of arguments - got (tuple, int), but expected one of:
* (Tensor input)
* (Tensor input, Tensor other, Tensor out)
* (Tensor input, int dim, bool keepdim, tuple of Tensors out)
아래와 같이 코드 한 줄을 추가했다.
* 참고
model = models.inception_v3(pretrained=True)
model.aux_logits=False # 추가된 부분!
한편 위와 같이 aux_logits를 False로 두면, inception v2와 같다고 한다.
왜 그렇게 하는지는 아래 링크에 나와 있다.(이해는 가지 않는다......)
https://discuss.pytorch.org/t/why-auxiliary-logits-set-to-false-in-train-mode/40705/18
Why Auxiliary logits set to false in train mode?
@ptrblck Hi! This time, there is little confusion with the fc layer. I followed the finetune tutorial (just want to run with aux_logits=True): for inception as there is only one aux_logit below snippet working fine. elif model_name == "inception": """ Ince
discuss.pytorch.org
728x90