class_docstr: Test d9m-unimplemented exceptions from SparseSoftmaxXentWithLogitsOp.
  
  Test that tf.errors.UnimplementedError is thrown, as
  appropriate, by the GPU code-paths through SparseSoftmaxXentWithLogitsOp when
  deterministic ops are enabled.
  
  This test assumes that sparse_xent_op_test.py runs equivalent test cases
  when deterministic ops are not enabled and will therefore detect erroneous
  exception throwing in those cases.
class_docstr_tok: ["Test","d9m-unimplemented","exceptions","from","SparseSoftmaxXentWithLogitsOp",".","Test","that","tf.errors.UnimplementedError","is","thrown",",","as","appropriate",",","by","the","GPU","code-paths","through","SparseSoftmaxXentWithLogitsOp","when","deterministic","ops","are","enabled",".","This","test","assumes","that","sparse_xent_op_test.py","runs","equivalent","test","cases","when","deterministic","ops","are","not","enabled","and","will","therefore","detect","erroneous","exception","throwing","in","those","cases","."]
code: def testExceptionThrowing(self):
      with self.session(), test_util.force_gpu():
          for features_dtype in [dtypes.float16, dtypes.float32]:
              for labels_dtype in [dtypes.int32, dtypes.int64]:
                  features = constant_op.constant(
                      [[0.3, 0.5], [0.2, 0.6]], dtype=features_dtype
                  )
                  labels = constant_op.constant(
                      [1, 0], dtype=labels_dtype
                  )
                  with self.assertRaisesRegex(
                      errors_impl.UnimplementedError,
                      "The GPU implementation of SparseSoftmaxCrossEntropyWithLogits "
                      + "that would have been executed is not deterministic. Note that "
                      + "the Python API uses an alternative, deterministic, "
                      + "GPU-accelerated path when determinsim is enabled.",
                  ):
                      result = gen_nn_ops.sparse_softmax_cross_entropy_with_logits(
                          features=features, labels=labels
                      )
                      self.evaluate(result)
  
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.sparse_ops import sparse_xent_op_test_base
  from tensorflow.python.ops.nn_grad import _SparseSoftmaxCrossEntropyWithLogitsGrad
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the SparseXentOpDeterminismExceptionsTest obj's underlying member method code with example usage: obj.testExceptionThrowing() without return types