code: def __init__(
      self,
      ignore_index=IGNORE_INDEX_TOKEN_ID,
      reduction="elementwise_mean",
  ):
      assert reduction in ["elementwise_mean", "sum", "none"]
      self.reduction = reduction
      self.ignore_index = ignore_index
      super().__init__()
  
imports: import torch
  import torch.nn
  from torch.autograd import Function
  from ludwig.constants import IGNORE_INDEX_TOKEN_ID
  from ludwig.utils.entmax.activations import entmax15, sparsemax
  from ludwig.utils.entmax.root_finding import entmax_bisect, sparsemax_bisect
label_desc: Use image node_id 1 to create a new _GenericLoss object from inherited base classes: nn with example: obj = _GenericLoss(ignore_index, reduction)