docstr: Demonstrates using the global generator with XLA.
code: def testGetGlobalGeneratorWithXla(self):
      """Demonstrates using the global generator with XLA."""
      # This test was passing before because soft placement silently picked the
      # CPU kernel.
      # TODO(wangpeng): Remove this skip
      self.skipTest("NonDeterministicInts lacks XLA kernel.")
  
      if not config.list_physical_devices("XLA_CPU"):
          self.skipTest("No XLA_CPU device available.")
  
      random.set_global_generator(None)
  
      @def_function.function(jit_compile=True)
      def make_seed():
          generator = random.get_global_generator()
          state = array_ops.identity(generator.state, name="state")
          return (
              generator.uniform_full_int(
                  (2,), dtypes.int32, name="seed"
              ),
              state,
          )
  
      with ops.device("/device:XLA_CPU:0"):
          seed, state = make_seed()
          self.assertTrue(np.all(np.isfinite(seed.numpy())))
          random.get_global_generator().reset(state)
          self.assertAllEqual(make_seed()[0], seed)
  
imports: import os
  import re
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  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
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.kernel_tests.random import util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_random_ops
  from tensorflow.python.ops import gen_stateful_random_ops
  from tensorflow.python.ops import logging_ops
  from tensorflow.python.ops import random_ops_util
  from tensorflow.python.ops import stateful_random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 32 for calling the StatefulRandomOpsTest obj's underlying member method code with example usage: obj.testGetGlobalGeneratorWithXla() and returns: generator,  state