class_docstr: Label loss with an optional regularizer for smoothing.
code: def __init__(self, config, ignore_index=1):
      self.beta = config.beta
      self.label_loss_fn = create_loss(
          config.label_loss, ignore_index=ignore_index
      )
      self.smoothing_loss_fn = create_loss(
          config.smoothing_loss, ignore_index=ignore_index
      )
      self.ignore_index = ignore_index
  
      # Tracking variables.
      self.label_loss = 0
      self.smoothing_loss = 0
  
imports: from typing import Union
  import torch
  from pytext.config import ConfigBase
  from pytext.config.component import create_loss
  from .loss import HingeLoss, Loss, maybe_log_normalize, NLLLoss, SourceType
  from .regularizer import AdaptiveRegularizer, EntropyRegularizer, UniformRegularizer
  from .structured_loss import StructuredLoss, StructuredMarginLoss
label_desc: Use image node_id 1 to create a new LabelSmoothingLoss object from inherited base classes: Loss with example: obj = LabelSmoothingLoss(config, ignore_index)