class_docstr: Label smoothing loss with sample-wise logging.
code: def __call__(self, logits, targets, reduce=True, batch_size=None):
      label_loss = self.label_loss_fn(logits, targets, reduce=False)
      smoothing_loss = self.smoothing_loss_fn(
          logits, targets, reduce=False
      )
  
      # Unless specified, batch_size is equal to the length of logits.
      if batch_size is None:
          batch_size = logits.shape[0]
  
      # Extract sample-wise losses and reduce regular losses.
      (
          samplewise_label_loss,
          samplewise_smoothing_loss,
          label_loss,
          smoothing_loss,
      ) = self._reduce_mean(
          logits=logits,
          targets=targets,
          batch_size=batch_size,
          label_loss=label_loss,
          smoothing_loss=smoothing_loss,
          reduce=reduce,
      )
  
      # Set sample-wise tracking variables.
      self.samplewise_label_loss = samplewise_label_loss
      self.samplewise_smoothing_loss = samplewise_smoothing_loss
      self.samplewise_total_loss = (
          (
              samplewise_label_loss
              + self.beta * samplewise_smoothing_loss
          )
          if samplewise_label_loss is not None
          and samplewise_smoothing_loss is not None
          else None
      )
  
      # Set tracking variables.
      self.label_loss = label_loss
      self.smoothing_loss = smoothing_loss
  
      loss = label_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 3 for calling the SamplewiseLabelSmoothingLoss obj's underlying member method code with example usage: obj.__call__(logits, targets, reduce, batch_size) and returns: loss