Hello, I’m implementing a research paper, and I need to calculate the F.cross_entropy for each class separately as I will be using them later separately before joining them as the final loss (like the attached image). I was wondering how I could do it? Thanks.
I’m not entirely sure, but you could try to use the unreduced loss via reduction='none'
, apply your custom operations, and reduce it afterwards.
Thank you. As you said, it gave me the individual terms (per observation cross_entropy) that I separated out in order to create each of the two summation terms.