Keep in mind that in a bigger than 90/10 unbalance setting, you will be presenting your network with more than 90 % cases of fairly small losses (weighted by 1/n_samples). While once in a while the other class of less than 10 % will pop up with a huge loss resulting in a relatively huge update step, forcing you to nevertheless stay at a moderate learning rate.
Now if you combine this with some sophisticated augmentation pipeline as is often necessary, this can become a real waste of resources (electricity bill).
I think for anything bigger than tiny datasets it is can be recommended to upsample the minority classes. This can be achieved with light memory footprint by using the weighted samplers provided with pytorch.
As a side note: an additional quite natural case where class weights come up is, when on deployment we know that the economic cost of a misclassification of class (a) is much higher than the economic cost of class (b). Then we can just take that cost (2 to 1) and put it into our CrossEntropyLoss [2.0, 1.0].