code: def forward(self, inputs, targets):
      log_probs = self.logsoftmax(inputs)
      targets = torch.zeros_like(log_probs).scatter_(
          1, targets.unsqueeze(1), 1
      )
      targets = (
          1 - self.epsilon
      ) * targets + self.epsilon / self.num_classes
      loss = (-targets * log_probs).mean(0).sum()
      return loss
  
file_path: nni/examples/nas/legacy/oneshot/spos/utils.py
imports: import torch
  import torch.nn
  import numpy
  import PIL
label_desc: Use image node_id 2 for calling the CrossEntropyLabelSmooth obj's underlying member method code with example usage: obj.forward(inputs, targets) and returns: loss