code: def _VariableRankTest(
      self, np_scatter, tf_scatter, vtype, itype, repeat_indices=False
  ):
      np.random.seed(8)
      ref_shapes = [
          (3, 6),
          (3, 6),
          (3, 6, 9),
          (3, 6, 9),
          (3, 6, 9),
          (3, 6, 9),
      ]
      indices_shapes = [(2,), (2, 2), (2,), (2, 2), (2, 3), (2, 3, 3)]
      for ref_shape, indices_shape in zip(ref_shapes, indices_shapes):
          num_updates = indices_shape[0]
          ixdim = indices_shape[-1]
  
          indexable_area_shape = ()
          for i in range(ixdim):
              indexable_area_shape += (ref_shape[i],)
          all_indices = [
              list(coord)
              for coord, _ in np.ndenumerate(
                  np.empty(indexable_area_shape, vtype)
              )
          ]
          np.random.shuffle(all_indices)
          indices = np.array(all_indices[:num_updates])
  
          if num_updates > 1 and repeat_indices:
              indices = indices[: num_updates // 2]
              for _ in range(num_updates - num_updates // 2):
                  indices = np.append(
                      indices,
                      [indices[np.random.randint(num_updates // 2)]],
                      axis=0,
                  )
              np.random.shuffle(indices)
          indices = _AsType(indices[:num_updates], itype)
  
          updates_shape = (num_updates,)
          for i in range(ixdim, len(ref_shape)):
              updates_shape += (ref_shape[i],)
          updates = _AsType(np.random.randn(*(updates_shape)), vtype)
  
          # Scatter via numpy
          np_out = np_scatter(indices, updates, ref_shape)
          # Scatter via tensorflow
          tf_out = tf_scatter(indices, updates, ref_shape)
  
          self.assertAllClose(np_out, tf_out)
  
imports: import functools
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the ScatterNdTest obj's underlying member method code with example usage: obj._VariableRankTest(np_scatter, tf_scatter, vtype, itype, repeat_indices) without return types