code: def _compute_negative_kl_divergence(
      self, logits, targets, reduce=True, ignore_index=-100
  ):
      batch_size, num_classes = logits.shape[0], logits.shape[1]
      all_kls = []
  
      for i in range(batch_size):
          log_probs = logits[i] - logsumexp(logits[i])
          kl_div = torch.sum(log_probs) / num_classes
          all_kls.append(kl_div)
  
      all_kls = np.array(all_kls)
      to_include_indices = targets.numpy() != ignore_index
      return np.mean(all_kls[to_include_indices]) if reduce else all_kls
  
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 4 for calling the LabelSmoothedCrossEntropyLossTest obj's underlying member method code with example usage: obj._compute_negative_kl_divergence(logits, targets, reduce, ignore_index) and returns: unknown