Hi,
I try to load the pretrained ResNet-18 network, create a new sequential model with the layers
of the pretrained network without the top fully connected layer and then add another fully connected layer so it would match my data (of two classes only). I tried the go by the tutorials but I keep getting the next error:
RuntimeError: size mismatch, m1: [16384 x 1], m2: [16384 x 2]
This is my cod:
class CNN(nn.Module):
    def __init__(self, num_classes):
        super(CNN, self).__init__()
              self.model_resnet = models.resnet18(pretrained=True)
              self.seq = nn.Sequential(*list(self.model_resnet.children()
              fc_inputs = self.model_resnet.fc.in_features
              self.label_model = nn.Linear(fc_inputs * 32, num_classes)

    def forward(self, images):
             with torch.no_grad():
                  features = self.seq(images)
             labels = self.label_model(features)
             return labels

Thank you!