class_docstr: NLL loss with label smoothing.
      
class_docstr_tok: ["NLL","loss","with","label","smoothing","."]
code: def forward(
      self, x: torch.Tensor, target: torch.Tensor
  ) -> torch.Tensor:
      logprobs = F.log_softmax(x, dim=-1)
      nll_loss = -logprobs.gather(dim=-1, index=target.unsqueeze(1))
      nll_loss = nll_loss.squeeze(1)
      smooth_loss = -logprobs.mean(dim=-1)
      loss = self.confidence * nll_loss + self.smoothing * smooth_loss
      return loss.mean()
  
file_path: pytorch-image-models/timm/loss/cross_entropy.py
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the LabelSmoothingCrossEntropy obj's underlying member method code with example usage: obj.forward(x, target) and returns: loss