Hi Charles!



 KawaiiNotHawaii:

loss_fn = nn.CrossEntropyLoss()
loss = loss_fn(input, labels) + loss_fn(input.T, labels2)



I am skeptical of your proposed use case.  However:
In its most common usage, CrossEntropyLoss takes integer class
labels for its target.  These should be integers that run from zero
to the number of classes you have, that is to say, the size of the
nClass dimension of the input.  Note that transposing your input
can change which values are valid for your class labels.
Here is an example of transposing the input where the corresponding
class labels are constructed to be valid:
>>> import torch
>>> torch.__version__
'1.9.0'
>>> _ = torch.manual_seed (2021)
>>> x = 3
>>> y = 5
>>> input = torch.randn (x, y)
>>> labels = torch.randint (y, (x,))
>>> labels2 = torch.randint (x, (y,))
>>> loss_fn = torch.nn.CrossEntropyLoss()
>>> loss_fn (input, labels)
tensor(2.5805)
>>> loss_fn (input.T, labels2)
tensor(2.9129)

Best.
K. Frank