Hey Tom, a question regarding the loss per class: when I change the loss to use reduction='none' I get a tensor with the same values as the target (1,512,512), I didn’t understand how the filtering is done to acquire the loss per class, as far as I know, I am supposed to take the mean of each dimension for each class (?). Also say I get the loss per class, I still need to compute the mean of the loss using the custom weights that I have prepared, any idea on how to do this efficiently? my idea was to use two loss variables, one with reduction set to mean to calculate the loss as per usual and another variable with the reduction set to none for class loss calculation…