code: def test_jit(self, module_fn: ModuleFn, shape, dtype):
      rng = jax.random.PRNGKey(42)
      if jnp.issubdtype(dtype, jnp.integer):
          x = jax.random.randint(rng, shape, 0, np.prod(shape), dtype)
      else:
          x = jax.random.uniform(rng, shape, dtype)
  
      def g(x):
          return module_fn()(x)
  
      f = hk.transform_with_state(g)
  
      atol = CUSTOM_ATOL.get(
          descriptors.module_type(module_fn), DEFAULT_ATOL
      )
      assert_allclose = functools.partial(
          np.testing.assert_allclose, atol=atol
      )
  
      # Ensure initialization under jit is the same.
      jax.tree_util.tree_map(
          assert_allclose, f.init(rng, x), jax.jit(f.init)(rng, x)
      )
  
      # Ensure application under jit is the same.
      params, state = f.init(rng, x)
      jax.tree_util.tree_map(
          assert_allclose,
          f.apply(params, state, rng, x),
          jax.jit(f.apply)(params, state, rng, x),
      )
  
file_path: dm-haiku/haiku/_src/integration/jax_transforms_test.py
imports: import functools
  from absl.testing import absltest
  from absl.testing import parameterized
  import haiku
  from haiku._src import test_utils
  from haiku._src.integration import descriptors
  import jax
  import jax.numpy
  import numpy
label_desc: Use image node_id 1 for calling the JaxTransformsTest obj's underlying member method code with example usage: obj.test_jit(module_fn, shape, dtype) and returns: module_fn