Hi guys. If the dimension of the tensor is [x, y], then the dimension of the labels for the loss would be [x]. I want to create a loss - crossEntropyLoss([x, y], [x]) + crossEntropyLoss([y, x], [y]). For the second part, I transpose the original [x, y] tensor, but it keeps giving errors. I also tried clone and transpose but nothing works, it keeps throwing the same error.
loss_fn = nn.CrossEntropyLoss()
loss = loss_fn(input, labels) + loss_fn(input.T, labels2)

So the problem is how can I transpose a input and use it in the loss function?
Thanks a lot