Yeah! The implementation looks correct to me.
Also, since both of your output is using non weighted cross-entropy loss, you can even use one nn.CrossEntropyLoss() as a criterion for both of them.
batch_size = 10
nb_classes = 4
criterion = nn.CrossEntropyLoss()
a = torch.randn(batch_size, nb_classes)
b = torch.randn(batch_size, nb_classes)
target = torch.empty(batch_size, dtype=torch.long).random_(nb_classes)
criterion(a, target)
# tensor(1.5086)
criterion(b, target)
# tensor(1.4570)