class_docstr: CrossEntropyLoss.
  
  Args:
      use_sigmoid (bool, optional): Whether the prediction uses sigmoid
          of softmax. Defaults to False.
      use_mask (bool, optional): Whether to use mask cross entropy loss.
          Defaults to False.
      reduction (str, optional): . Defaults to 'mean'.
          Options are "none", "mean" and "sum".
      class_weight (list[float] | str, optional): Weight of each class. If in
          str format, read them from a file. Defaults to None.
      loss_weight (float, optional): Weight of the loss. Defaults to 1.0.
      loss_name (str, optional): Name of the loss item. If you want this loss
          item to be included into the backward graph, `loss_` must be the
          prefix of the name. Defaults to 'loss_ce'.
      avg_non_ignore (bool): The flag decides to whether the loss is
          only averaged over non-ignored targets. Default: False.
          `New in version 0.23.0.`
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(
      self,
      cls_score,
      label,
      weight=None,
      avg_factor=None,
      reduction_override=None,
      ignore_index=-100,
      **kwargs,
  ):
      """Forward function."""
      assert reduction_override in (None, "none", "mean", "sum")
      reduction = (
          reduction_override if reduction_override else self.reduction
      )
      if self.class_weight is not None:
          class_weight = cls_score.new_tensor(self.class_weight)
      else:
          class_weight = None
      # Note: for BCE loss, label < 0 is invalid.
      loss_cls = self.loss_weight * self.cls_criterion(
          cls_score,
          label,
          weight,
          class_weight=class_weight,
          reduction=reduction,
          avg_factor=avg_factor,
          avg_non_ignore=self.avg_non_ignore,
          ignore_index=ignore_index,
          **kwargs,
      )
      return loss_cls
  
file_path: dinov2/dinov2/eval/segmentation_m2f/models/losses/cross_entropy_loss.py
imports: import warnings
  import torch
  import torch.nn
  import torch.nn.functional
  from mmseg.models.builder import LOSSES
  from mmseg.models.losses.utils import get_class_weight, weight_reduce_loss
label_desc: Use image node_id 3 for calling the CrossEntropyLoss obj's underlying member method code with example usage: obj.forward(cls_score, label, weight, avg_factor, reduction_override, ignore_index) and returns: loss_cls