Hi Shakeel!



 shakeel608:

Does it boosts the gradient or the it increases the number of updates.


I suggest that you try a quick test.
Don’t use a model.  Just create pred with requires_grad = True:
pred = torch.randn (10, 2, requires_grad = True)

Then create some target class labels:
targ = torch.randint (2, (10, ))

Then calculate and backpropagate CrossEntropyLoss with
various choices for weight and see what happens:
torch.nn.CrossEntropyLoss (weight = my_class_weights) (pred, targ).backward()
print (pred.grad)

Best.
K. Frank