What is the weight values mean in torch.nn.CrossEntropyLoss?

If you have a roughly balanced problem, you don’t need to use weights. If you have imbalance, 1/class_size is a typical choice.

Best regards

Thomas

2 Likes