class_docstr: Test cases for stateless random-number generator operators.
class_docstr_tok: ["Test","cases","for","stateless","random-number","generator","operators","."]
code: def testDeterminism(self, stateless_op, shape, dtype):
      # Stateless values should be equal iff the seeds are equal (roughly)
      seeds = [
          (x, y) for x in range(-2, 3) for y in range(-2, 3)
      ] * 3  # pylint: disable=g-complex-comprehension
      with self.session(), self.test_scope():
          seed_t = array_ops.placeholder(dtypes.int32, shape=[2])
          pure = stateless_op(shape, seed=seed_t, dtype=dtype)
          values = [
              (seed, pure.eval(feed_dict={seed_t: seed}))
              for seed in seeds
          ]
          for s0, v0 in values:
              for s1, v1 in values:
                  if s0 == s1:
                      self.assertAllEqual(v0, v1)
                  else:
                      # The resolutions of float16 and bfloat16 are too low, so
                      # in some cases (e.g. scalar shape) different seeds may
                      # lead to the same output. So we skip those dtypes.
                      if not (
                          dtype in (dtypes.bfloat16, dtypes.float16)
                          and shape == ()
                      ):  # pylint: disable=g-explicit-bool-comparison
                          self.assertNotAllEqual(v0, v1)
  
imports: import functools
  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 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_stateless_random_ops_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops_util
  from tensorflow.python.ops import stateless_random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the StatelessRandomOpsTest obj's underlying member method code with example usage: obj.testDeterminism(stateless_op, shape, dtype) without return types