I guess someone else too had the same issue.
Posting the answer found in another discussion here.
import torch
from torchvision import models
from torch.nn import nn
model = models.inception_v3(pretrained=True)
model.aux_logit=False
in_features = model.fc.in_features
model.fc = nn.Linear(in_features, 2)