code: def _npXent(self, labels, logits, dim=-1):
      if dim == -1:
          dim = len(logits.shape) - 1
      one_only_on_dim = list(logits.shape)
      one_only_on_dim[dim] = 1
      e = np.exp(
          logits
          - np.reshape(np.amax(logits, axis=dim), one_only_on_dim)
      )
      probs = e / np.reshape(np.sum(e, axis=dim), one_only_on_dim)
      bp = probs - labels
      l = -np.sum(labels * np.log(probs + 1.0e-20), axis=dim)
      return l, bp
  
imports: import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops.nn_grad import _SoftmaxCrossEntropyWithLogitsGrad
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the XentOpTestBase obj's underlying member method code with example usage: obj._npXent(labels, logits, dim) and returns: l,  bp