Well, even though I had the right dim I need to pick the last value of nn.Linear(…, last) to match the length of my class
for param in model.parameters():
    param.requires_grad = False
    
model.fc = nn.Sequential(nn.Linear(2048, 512),
                                 nn.ReLU(),
                                 nn.Dropout(0.2),
                                 nn.Linear(512, 2),
                                 nn.LogSoftmax(dim=1))
criterion = nn.NLLLoss()
optimizer = optim.Adam(model.fc.parameters(), lr=0.003)
model.to(device);

model.fc = nn.Sequential(nn.Linear(x, y),
nn.ReLU(),
nn.Dropout(0.2),
nn.Linear(y, len(class)),
nn.LogSoftmax(dim=1))