code: def _testHighDim(self, labels, logits):
      np_loss, np_gradient = self._npXent(
          labels=np.array(labels), logits=np.array(logits)
      )
      # manually reshape loss
      np_loss = np.reshape(np_loss, np.array(labels).shape)
      tf_loss = nn_ops.sparse_softmax_cross_entropy_with_logits_v2(
          labels=labels, logits=logits
      )
      with backprop_lib.GradientTape() as tape:
          logits = constant_op.constant(logits)
          tape.watch(logits)
          tf_gradient = tape.gradient(
              nn_ops.sparse_softmax_cross_entropy_with_logits_v2(
                  labels=labels, logits=logits
              ),
              [logits],
          )[0]
          tf_gradient = array_ops.reshape(
              tf_gradient, np_gradient.shape
          )
  
      self.assertAllCloseAccordingToType(np_loss, tf_loss)
      self.assertAllCloseAccordingToType(np_gradient, tf_gradient)
  
imports: import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  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_v2
  from tensorflow.python.ops import nn_ops
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 22 for calling the SparseXentOpTestBase obj's underlying member method code with example usage: obj._testHighDim(labels, logits) without return types