class_docstr: Tests for Numpy indexing translation rules.
class_docstr_tok: ["Tests","for","Numpy","indexing","translation","rules","."]
code: def testDynamicIndexingWithSlices(
      self, shape, dtype, rng_factory, indexer
  ):
      rng = rng_factory()
      unpacked_indexer, pack_indexer = self._ReplaceSlicesWithTuples(
          indexer
      )
  
      def onp_fun(x, unpacked_indexer):
          indexer = pack_indexer(unpacked_indexer)
          return x[indexer]
  
      jnp_fun = lambda x, idx: onp_fun(tnp.asarray(x), idx)
  
      args_maker = lambda: [rng(shape, dtype), unpacked_indexer]
      self._CheckAgainstNumpy(
          onp_fun, jnp_fun, args_maker, check_dtypes=True
      )
      # TODO(wangpeng): check_xla_forced_compile is turned off because some
      # compile-time-constant requirements are violated. Investigate and turn it
      # on.
      self._CompileAndCheck(
          jnp_fun,
          args_maker,
          check_dtypes=True,
          check_eval_on_shapes=False,
          check_incomplete_shape=True,
          check_xla_forced_compile=False,
      )
  
imports: import collections
  import enum
  from functools import partial
  import itertools
  import unittest
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.framework import config
  from tensorflow.python.ops.numpy_ops.tests.config import config
  import tensorflow.python.ops.numpy_ops.tests.extensions
  import tensorflow.python.ops.numpy_ops.tests.np_wrapper
  import tensorflow.python.ops.numpy_ops.tests.test_util
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling the IndexingTest obj's underlying member method code with example usage: obj.testDynamicIndexingWithSlices(shape, dtype, rng_factory, indexer) and returns: x