I am trying to add in a pretrained resnet50 model and then tack on 2 extra Linear (FC) layers to that. I defined a Class with a few inputs like the below but it gives me an error.
RuntimeError: size mismatch, m1: [32 x 1000], m2: [2048 x 2048] at /opt/conda/conda-bld/pytorch_1579027003190/work/aten/src/THC/generic/THCTensorMathBlas.cu:290

I have an idea of what this error is saying that the resnet is producing the classification (1000) output and not the 2048 from an early FC layer. I just dont know how to get the FC layer out from the resnet model. So here is what I am doing.
# Create Resnet Model
resnet = models.resnet50(pretrained=True)
num_ftrs = resnet.fc.in_features
print(num_ftrs)

And then I call it in the class like this
class FinetuneResnet(nn.Module):
    def __init__(self, resnet_pretrain, resnet_filter, num_classes):
        super(FinetuneResnet, self).__init__()
        self.resnet = resnet_pretrain
        self.fc1 = nn.Linear(resnet_filter, 2048)
        self.fc2 = nn.Linear(2048, num_classes)
        self.dropout = nn.Dropout(0.3)
    
    def forward(self, x):
        x = self.resnet(x)
        x = torch.relu(self.fc1(x))
        x = self.dropout(x)
        x = torch.softmax(self.fc2(x))
        return x

Which is used like this
model = FinetuneResnet(resnet, num_ftrs, num_classes)

Thank you for any help with this.