Solved by planet_pluto in post #2 
              
              
                There’s some issue with your predictions and targets. 
From the docs: 
 [image] 
Let’s assume we have 4 classes. The predictions should be of shape torch.Size([1, 4]) and targets of shape torch.Size([1]) 
I made a few modifications to your code and this seems to work for me. 
class WeightedFocalLoss…