code: def _compute_negative_cross_entropy_loss(
      self, logits, targets, weight=None, reduce=True, ignore_index=-100
  ):
      batch_size = logits.shape[0]
      all_losses = []
  
      for i in range(batch_size):
          if targets[i] == ignore_index:
              # assign 0.0 because we don't care about this index
              loss = 0.0
          else:
              loss = logsumexp(logits[i]) - logits[i, targets[i]]
              if weight is not None:
                  loss = loss * weight[targets[i]]
          all_losses.append(loss)
  
      all_losses = np.array(all_losses)
      to_include_indices = targets.numpy() != ignore_index
      return (
          np.mean(all_losses[to_include_indices])
          if reduce
          else all_losses
      )
  
file_path: pytext/pytext/loss/tests/label_smoothing_loss_test.py
imports: import caffe2.python.hypothesis_test_util
  import numpy
  import torch
  from pytext.loss.loss import LabelSmoothedCrossEntropyLoss, SourceType
  from scipy.special import logsumexp
label_desc: Use image node_id 3 for calling the LabelSmoothedCrossEntropyLossTest obj's underlying member method code with example usage: obj._compute_negative_cross_entropy_loss(logits, targets, weight, reduce, ignore_index) and returns: unknown