The provided shapes are for nn.CrossEntropyLoss and nn.MSELoss expects the tensors to have the same shape or broadcastable as explained in the first post.
If you want to use nn.MSELoss for a classification use case, you could probably create a one-hot encoded tensor via:
label_batch = F.one_hot(label_batch, num_classes=5)