Let’s say i have to train an image classifier an a highly unbalanced dataset. Then I would like to penalize the losses belonging to the dominating classes less and vice versa !
Can you pls show with a few lines of code how exactly  weights  in nn.BCEWithLogitsLossis passed ?
Imagine we have a dataset in which we have three classes with the following number of examples:
classA: 900
classB: 90
classC: 10
now how would you define ur loss function and how would you pass the weights argument?
would it be like
loss_fn = nn.CrossEntropyLoss(weight = [1- 900/1000, 1- 90/1000, 1 - 10/1000]) ???