How to implement focal loss in pytorch?

Hi Ben.
Have you confirmed that training with gamma=0 is same to with cross entropy loss?
I tried that in my implementation of focal loss. The result became very different :scream::scream:

And I ask someone to answer my forum question. I can’t identify the problem.