class_docstr: Test that SoftmaxCrossEntropyWithLogits operates reproducibly.
  
  Inheriting from xent_op_test_base.XentTestBase ensures that regular op
  functionality is correct when the deterministic code-path is selected.
  
  Note that because nn_ops.softmax_cross_entropy_with_logits calls
  nn_ops.cross_entropy_with_logits_v2, the focus of testing is on the
  former in order to test both.
code: def testBackward(self):
      with self.cached_session():
          for dtype in [
              np.float16,
              np.float32,
              np.float64,
              dtypes.bfloat16.as_numpy_dtype,
          ]:
              labels, logits = self._generateInputs(dtype, seed=456)
              output_shape = labels.shape[0]
  
              def gradients(seed):
                  np.random.seed(seed)
                  upstream_gradients = self._randomFloats(
                      output_shape, dtype
                  )
                  with backprop.GradientTape(persistent=True) as tape:
                      tape.watch(labels)
                      tape.watch(logits)
                      op_output = (
                          nn_ops.softmax_cross_entropy_with_logits(
                              labels=labels, logits=logits
                          )
                      )
                      gradient_injector_output = (
                          op_output * upstream_gradients
                      )
                  return tape.gradient(
                      gradient_injector_output, [labels, logits]
                  )
  
              for trial in range(5):
                  seed = 456 + trial
                  labels_grad_a, logits_grad_a = gradients(seed=seed)
                  labels_grad_b, logits_grad_b = gradients(seed=seed)
                  self.assertAllEqual(labels_grad_a, labels_grad_b)
                  self.assertAllEqual(logits_grad_a, logits_grad_b)
  
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 errors_impl
  from tensorflow.python.framework import test_util
  from tensorflow.python.kernel_tests.nn_ops import xent_op_test_base
  from tensorflow.python.ops import gen_nn_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 4 for calling the XentOpDeterministicTest obj's underlying member method code with example usage: obj.testBackward() and returns: tape