torch.nn.CrossEntropyLoss(weight=None, size_average=None, ignore_index=- 100, reduce=None, reduction='mean', label_smoothing=0.0)

Note that CrossEntropyLoss has an option weight=None and



weight (Tensor, optional) – a manual rescaling weight given to each class. If given, has to be a Tensor of size C