RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x65536 and 32x20)' in my implementation of resnet50

I have defined my Resnet50 following a tutorial:

class ResNet(nn.Module):
    def __init__(self):
        super(ResNet, self).__init__()
        self.resnet = resnet50(pretrained=True)
        # isolate the feature blocks
        self.features = nn.Sequential(self.resnet.conv1,
                              nn.MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False),

       # average pooling layer
        self.avgpool = self.resnet.avgpool
        self.classifier = self.resnet.fc

    # gradient placeholder
        self.gradient = None
    def activations_hook(self, grad):
        self.gradients = grad
    def get_gradient(self):
        return self.gradient
    def get_activations(self, x):
        return self.features(x)
    def forward(self, x):
        x = self.features(x)
        h = x.register_hook(self.activations_hook)
        # complete the forward pass
        x = self.avgpool(x)
        x = x.view((1, -1))
        x = self.classifier(x)
        return x

However, I am getting the error

RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x65536 and 32x20)

I tried defining the classifier like the following:

self.classifier = nn.Sequential(nn.Linear(65536, 1000), nn.Dropout())

but now I am getting the error ValueError: Target size (torch.Size([32, 20])) must be the same as input size (torch.Size([1, 1000]))

Any suggestions for me? Thank you in advance

Double post from here with a follow-up.