class_docstr: A soft version of negative log likelihood loss with support for label smoothing.
  
  Effectively equivalent to PyTorch's :class:`torch.nn.NLLLoss`, if `label_smoothing`
  set to zero. While the numerical loss values will be different compared to
  :class:`torch.nn.NLLLoss`, this loss results in the same gradients. This is because
  the implementation uses :class:`torch.nn.KLDivLoss` to support multi-class label
  smoothing.
  
  Args:
      label_smoothing (float):
          The smoothing parameter :math:`epsilon` for label smoothing. For details on
          label smoothing refer `this paper <https://arxiv.org/abs/1512.00567v1>`__.
      weight (:class:`torch.Tensor`):
          A 1D tensor of size equal to the number of classes. Specifies the manual
          weight rescaling applied to each class. Useful in cases when there is severe
          class imbalance in the training set.
      num_classes (int):
          The number of classes.
      size_average (bool):
          By default, the losses are averaged for each minibatch over observations **as
          well as** over dimensions. However, if ``False`` the losses are instead
          summed. This is a keyword only parameter.
class_docstr_tok: ["A","soft","version","of","negative","log","likelihood","loss","with","support","for","label","smoothing",".","Effectively","equivalent","to","PyTorch","'s",":","class",":","`","torch.nn.NLLLoss","`",",","if","`","label_smoothing","`","set","to","zero",".","While","the","numerical","loss","values","will","be","different","compared","to",":","class",":","`","torch.nn.NLLLoss","`",",","this","loss","results","in","the","same","gradients",".","This","is","because","the","implementation","uses",":","class",":","`","torch.nn.KLDivLoss","`","to","support","multi-class","label","smoothing",".","Args",":","label_smoothing","(","float",")",":","The","smoothing","parameter",":","math",":","`","epsilon","`","for","label","smoothing",".","For","details","on","label","smoothing","refer","`","this","paper","<","https",":","\/\/arxiv.org\/abs\/1512.00567v1",">","`","__",".","weight","(",":","class",":","`","torch.Tensor","`",")",":","A","1D","tensor","of","size","equal","to","the","number","of","classes",".","Specifies","the","manual","weight","rescaling","applied","to","each","class",".","Useful","in","cases","when","there","is","severe","class","imbalance","in","the","training","set",".","num_classes","(","int",")",":","The","number","of","classes",".","size_average","(","bool",")",":","By","default",",","the","losses","are","averaged","for","each","minibatch","over","observations","*","*","as","well","as","*","*","over","dimensions",".","However",",","if","``","False","``","the","losses","are","instead","summed",".","This","is","a","keyword","only","parameter","."]
code: def forward(self, input, target):
      one_hot = torch.zeros_like(input)
      one_hot.fill_(self.label_smoothing / (self.num_classes - 1))
      one_hot.scatter_(1, target.unsqueeze(1).long(), self.confidence)
  
      if self.weight is not None:
          one_hot.mul_(self.weight)
  
      return self.criterion(input, one_hot)
  
file_path: deepmatcher/deepmatcher/optim.py
imports: import logging
  import torch
  import torch.nn
  import torch.optim
  from torch.autograd import Variable
  from torch.nn.utils import clip_grad_norm_
label_desc: Use image node_id 2 for calling the SoftNLLLoss obj's underlying member method code with example usage: obj.forward(input, target) and returns: self