code: def cross_entropy(
      pred,
      label,
      weight=None,
      class_weight=None,
      reduction="mean",
      avg_factor=None,
      ignore_index=-100,
  ):
      """The wrapper function for :func:`F.cross_entropy`"""
      # class_weight is a manual rescaling weight given to each class.
      # If given, has to be a Tensor of size C element-wise losses
      loss = F.cross_entropy(
          pred,
          label,
          weight=class_weight,
          reduction="none",
          ignore_index=ignore_index,
      )
  
      # apply weights and do the reduction
      if weight is not None:
          weight = weight.float()
      loss = weight_reduce_loss(
          loss,
          weight=weight,
          reduction=reduction,
          avg_factor=avg_factor,
      )
  
      return loss
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/losses/cross_entropy_loss.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ..builder import LOSSES
  from .utils import get_class_weight, weight_reduce_loss
label_desc: Use image node_id 1 for calling a global function with example usage: cross_entropy(pred, label, weight, class_weight, reduction, avg_factor, ignore_index) and returns: loss