Hi Tejan!



 Tejan_Mehndiratta:

But shouldn’t the sum of the weight vector equal to 1?


No.  This kind of use case applies to CrossEntropyLoss, which computes
a weighted mean (when using the default reduction = 'mean').  This
means that CrossEntropyLoss divides by the sum of the weights, so
the sum of the weights drops out of the final loss value.
(It doesn’t hurt to have the weights sum to one; it just doesn’t matter.)
Best.
K. Frank