Hi Lukas!



 Lukas_Lansche:

Hi, I’m a little stuck with the CrossEntropyLoss,
…
both tensors, input and target have the same size of  [2, 5, 928, 928] with Batch_size = 2, number_classes = 5 and the image Size [928, 928]


This is your problem.  CrossEntropyLoss expects integer
class labels for its target.  So target should have shape
[2, 928, 928], and the target values should be integers
that run from 0 to 4.


I also tried the target as a not one-hot encoded tensor but ended in another error …


Try again not one-hotting your target.  If it still doesn’t work, please
post the code where you instantiate CrossEntropyLoss, the code
where you call your loss function, the shape of your input and
target, and any error messages you get.
Good luck.
K. Frank