The output looks as if it’s containing the logits for each class in the shape [batch_size, nb_classes]. I’m unsure why you would need the 8 separate loss functions, as you should be able to provide a tensor containing the weights for all classes to pos_weight.