but when I do
model = pretrainedmodels.densenet201(pretrained='imagenet')
   )
    (norm5): BatchNorm2d(1920, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  )
  (last_linear): Linear(in_features=1920, out_features=1000, bias=True)
)

model.classifier = nn.Linear(1920, dls.c)
model.classifier
Linear(in_features=1920, out_features=22, bias=True)

is when I get the error, I like this pretrained models

  
      
      GitHub
  
  
    

Cadene/pretrained-models.pytorch 56

Pretrained ConvNets for pytorch: NASNet, ResNeXt, ResNet, InceptionV4, InceptionResnetV2, Xception, DPN, etc. - Cadene/pretrained-models.pytorch


  
  
    
    
  
  


Maybe you can shed some light what is that doing wrong.
Thanks a lot!