Hi,
The weight parameter is usually with respect to labels, not batch samples !
It will apply the weight depending on the ground truth label for the given sample.
It will indeed rescale the gradients and is very useful if your dataset is unbalanced for example.