I follow your approach and got the loss.
prediction = torch.rand((1,3,5,5), dtype=torch.float32)
label = torch.randint(0,2,(1,3,5,5), dtype=torch.float32)
criterion = nn.CrossEntropyLoss()
label = torch.argmax(label, 1)
print(label.shape, prediction.shape, label.dtype, prediction.dtype)
loss = criterion(prediction, label)
print(loss)

torch.Size([1, 5, 5]) torch.Size([1, 3, 5, 5]) torch.int64 torch.float32
tensor(1.1114)