OK, just to clarify,
the dimension 0 would be the number of batches (5 in your case),
dimension 1 is number of samples in the batch (3 in your case)
so I set dim=1 to calculate logits (log probabilities) of each sample in the batch).