Hi fyy!



 fyy:

If I want to use CrossEntropyLoss ,I don’t konw  how to change my outputs’s shape and labels’s shape to correctly calculate the loss .


I still don’t think that you’re going about this the right way.  And I
doubt that you really have a 256-class classification problem.
I assume that the input to your model is some sort of image.
What is the conceptual meaning of such an image, and what
is its shape?
If you successfully train your model, what, at a high, conceptual
level, is your model supposed to tell you about an input image?
What do your labels mean?  To be concrete, you say that your
batch-of-labels tensor has shape [4, 244, 244].  What does
the value of a specific element of that tensor mean.  That is,
labels[0, 17, 128] is some number.  Conceptually, what
is that number telling us?
Best.
K. Frank