class_docstr: Label loss with an optional regularizer for smoothing.
code: def __call__(self, logits, targets, reduce=True):
      label_loss = self.label_loss_fn(logits, targets, reduce)
  
      # Flatten logits if we're using a structured label loss.
      if isinstance(self.label_loss_fn, StructuredLoss):
          logits = logits.reshape(-1, logits.size(-1))
          targets = targets.view(-1)
  
      smoothing_loss = self.smoothing_loss_fn(logits, targets, reduce)
  
      # Set tracking variables.
      self.label_loss = label_loss
      self.smoothing_loss = smoothing_loss
  
      loss = label_loss
      if self.beta > 0:
          # if beta is 0 and logits contains -inf smoothing_loss will
          # messup
          loss += self.beta * smoothing_loss
  
      return loss
  
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 2 for calling the LabelSmoothingLoss obj's underlying member method code with example usage: obj.__call__(logits, targets, reduce) and returns: loss