class_docstr: Test cases for stateful random-number generator operators.
class_docstr_tok: ["Test","cases","for","stateful","random-number","generator","operators","."]
docstr: Tests that XLA and CPU kernels generate the same integers.
docstr_tok: ["Tests","that","XLA","and","CPU","kernels","generate","the","same","integers","."]
code: def testXLAEqualsCPU(self, dtype):
      """Tests that XLA and CPU kernels generate the same integers."""
      seed = 1234
      shape = [315, 49]
      with ops.device("/device:CPU:0"):
          cpu_gen = random.Generator.from_seed(
              seed=seed, alg=random.RNG_ALG_PHILOX
          )
      with ops.device(xla_device_name()):
          xla_gen = random.Generator.from_seed(
              seed=seed, alg=random.RNG_ALG_PHILOX
          )
      # Repeat multiple times to make sure that the state after
      # number-generation are the same between CPU and XLA.
      for _ in range(5):
          with ops.device("/device:CPU:0"):
              # Test both number-generation and skip
              cpu = cpu_gen.uniform_full_int(shape=shape, dtype=dtype)
              cpu_gen.skip(100)
          with ops.device(xla_device_name()):
              xla = xla_gen.uniform_full_int(shape=shape, dtype=dtype)
              xla_gen.skip(100)
          self.assertAllEqual(cpu, xla)
          self.assertAllEqual(cpu_gen.state, xla_gen.state)
  
imports: import itertools
  import os
  from absl.testing import parameterized
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.client import device_lib
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  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.kernel_tests.random import util
  from tensorflow.python.ops import gen_stateful_random_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 flags
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the StatefulRandomOpsTest obj's underlying member method code with example usage: obj.testXLAEqualsCPU(dtype) without return types