class_docstr: Computes the softmax cross entropy loss with label-smoothing
  
  .. math::
  
      \DeclareMathOperator{softmax}{softmax}
  
      lp = \log \softmax({pred})
  
      L = - [(1 - \alpha) \sum_{i=1}^N (lp_{i, {label}_i}) + \alpha \frac{1}{N} \sum_{j=1}^N (lp_{i, j})]
  
  To reduce complexity, we can implement it as
  
  .. math::
  
      L = -\sum_i (\frac{N \alpha - 1}{N-1} lp_{i, {label}_i} + \frac{1 - \alpha}{N - 1} \sum_j lp_{i, j})
  
  Parameters
  ----------
  num_labels
      The number of possible labels. For example, in NLP, it can be the size of the vocabulary.
  alpha
      The uncertainty that will be injected to the labels. All the negative labels will be
      treated with probability equals to \frac{\alpha} / {N}
  from_logits
      Whether input is a log probability (usually from log_softmax) instead of unnormalized numbers.
class_docstr_tok: ["Computes","the","softmax","cross","entropy","loss","with","label-smoothing","..","math",":",":","\\DeclareMathOperator","{","softmax","}","{","softmax","}","lp","=","\\log","\\softmax","(","{","pred","}",")","L","=","-","[","(","1","-","\\alpha",")","\\sum_","{","i=1","}","^N","(","lp_","{","i",",","{","label","}","_i","}",")","+","\\alpha","\\frac","{","1","}","{","N","}","\\sum_","{","j=1","}","^N","(","lp_","{","i",",","j","}",")","]","To","reduce","complexity",",","we","can","implement","it","as","..","math",":",":","L","=","-\\sum_i","(","\\frac","{","N","\\alpha","-","1","}","{","N-1","}","lp_","{","i",",","{","label","}","_i","}","+","\\frac","{","1","-","\\alpha","}","{","N","-","1","}","\\sum_j","lp_","{","i",",","j","}",")","Parameters","--","--","--","--","--","num_labels","The","number","of","possible","labels",".","For","example",",","in","NLP",",","it","can","be","the","size","of","the","vocabulary",".","alpha","The","uncertainty","that","will","be","injected","to","the","labels",".","All","the","negative","labels","will","be","treated","with","probability","equals","to","\\frac","{","\\alpha","}","\/","{","N","}","from_logits","Whether","input","is","a","log","probability","(","usually","from","log_softmax",")","instead","of","unnormalized","numbers","."]
docstr: Parameters
  ----------
  pred :
      The predictions of the network. Shape (..., V)
  label :
      The labels. Shape (..., )
  
  Returns
  -------
  loss :
      Shape (..., )
docstr_tok: ["Parameters","--","--","--","--","--","pred",":","The","predictions","of","the","network",".","Shape","(","...",",","V",")","label",":","The","labels",".","Shape","(","...",",",")","Returns","--","--","--","-","loss",":","Shape","(","...",",",")"]
code: def forward(self, pred, label):
      """
  
      Parameters
      ----------
      pred :
          The predictions of the network. Shape (..., V)
      label :
          The labels. Shape (..., )
  
      Returns
      -------
      loss :
          Shape (..., )
      """
      if not self._from_logits:
          pred = npx.log_softmax(pred, axis=-1)
      log_likelihood = npx.pick(pred, label, axis=-1)
      all_scores = pred.sum(axis=-1)
      loss = (
          -(1 - self._alpha) * log_likelihood
          - self._alpha / float(self._num_labels) * all_scores
      )
      return loss
  
imports: from mxnet.gluon import HybridBlock
  from mxnet import npx
label_desc: Use image node_id 2 for calling the LabelSmoothCrossEntropyLoss obj's underlying member method code with example usage: obj.forward(pred, label) and returns: loss