Solved by ptrblck in post #2 
              
              
                If seems you’ve initialized the model to output only 2 classes instead of 28: 
model_ft.fc = nn.Linear(num_ftrs,2)

so you might want to change the out_features to 28 for the last linear layer.