Squeezenet Fine Tuning

size mismatch, m1: [13000 x 13], m2: [1000 x 4] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:266

This is the error when i try to do Fine Tuning on SqueezeNet.

This is the code, i want to make regression with 4 output:

def squeezeNet_model():
    model_conv = models.squeezenet1_1(pretrained=True)
    mod = list(model_conv.classifier.children())
    mod.append(nn.Linear(1000, 4))
    new_classifier = nn.Sequential(*mod)
    model_conv.classifier = new_classifier

    return model_conv

Where i wrong?

I solved with something more simple:

def squeezeNet_model():
    model_Squeeze = models.squeezenet1_1(pretrained=True)
    num_out = 4
    # change the last conv2d layer
    model_Squeeze.classifier._modules["1"] = nn.Conv2d(512, num_out, kernel_size=(1, 1))

    return model_Squeeze