How about for nn.BCEWithLogitsLoss or for nn.BCELoss? How can we pass the weights? I mean I know I will be passing weight=weight but the weight tensor should contain only one element and how could we do that?