Here is my Neural network…
class GoogleNetPretrained(nn.Module):
def init(self):
    super(GoogleNetPretrained, self).__init__()
    
    googlenet = models.inception_v3(pretrained=False, aux_logits= False, transform_input=True)
    for param in googlenet.parameters():
        param.requires_grad_(True)
    modules = list(googlenet.children())[:-1]
    self.googlenet = nn.Sequential(*modules)
    self.linear1 = nn.Linear(googlenet.fc.in_features, 1024)
    self.linear2 = nn.Linear(1024, 512)
    self.linear3 = nn.Linear(512, 256)
    self.linear4 = nn.Linear(256, 32)
    self.linear5 = nn.Linear(32, 7)
    self.init_weights()

def init_weights(self):
    self.linear1.weight.data.normal_(0.0,0.02)
    self.linear1.bias.data.fill_(0)
    self.linear2.weight.data.normal_(0.0,0.02)
    self.linear2.bias.data.fill_(0)
    self.linear3.weight.data.normal_(0.0,0.02)
    self.linear3.bias.data.fill_(0)
    self.linear4.weight.data.normal_(0.0,0.02)
    self.linear4.bias.data.fill_(0)
    self.linear5.weight.data.normal_(0.0,0.02)
    self.linear5.bias.data.fill_(0)

def forward(self, images, istrain = False):
    print(images.size())
    #with torch.no_grad():
    features = self.googlenet(images)
    print(features.size())
    features = features.view(features.size(0), -1)
    print(features.size())
    features = f.dropout(self.linear1(features), p=0.3, training = istrain)
    print(features.size())
    features = f.dropout(self.linear2(features), p=0.3, training = istrain)
    print(features.size())
    features = f.dropout(self.linear3(features), p=0.3, training = istrain)
    print(features.size())
    features = f.dropout(self.linear4(features), p=0.3, training = istrain)
    print(features.size())
    features = self.linear5(features)
    return features

For a batch size of 1, I am expecting the size of the self.googlenet(images) output to be of size (1 X 2048) but I am getting a size of (1 X 2048 X 26 X 26)… Am I doing something incorrect…??
Here is the output of the forward function.
torch.Size([1, 3, 224, 224])
torch.Size([1, 2048, 26, 26])
torch.Size([1, 1384448])
RuntimeError: size mismatch, m1: [1 x 1384448], m2: [2048 x 1024] at c:\programdata\miniconda3\conda-bld\pytorch-cpu_1532498166916\work\aten\src\th\generic/THTensorMath.cpp:2070