Based on the output shape it looks like you have 32 different classes.
Your target shape, i.e. the segmentation mask, should have the shape [batch_size, 224, 224], and should contain the class indices as its values.
The spatial size mismatch between the target mask and the model output does matter, as you are trying to calculate the pixel-wise loss, i.e. each pixel prediction corresponds to the pixel target class.
You don’t have to use the *2d loss functions, as the vanilla loss functions now can take multi-dimensional tensors.
Here is a small dummy example for a segmentation use case:
batch_size = 1
c, h, w = 3, 10, 10
nb_classes = 5

x = torch.randn(batch_size, c, h, w)
target = torch.empty(batch_size, h, w, dtype=torch.long).random_(nb_classes)

model = nn.Sequential(
    nn.Conv2d(c, 6, 3, 1, 1),
    nn.ReLU(),
    nn.Conv2d(6, nb_classes, 3, 1, 1)
)

criterion = nn.CrossEntropyLoss()

output = model(x)
loss = criterion(output, target)
loss.backward()