class_docstr: Tests for LAX-backed Numpy reduction operations.
class_docstr_tok: ["Tests","for","LAX-backed","Numpy","reduction","operations","."]
code: def testReducerInitial(
      self,
      name,
      rng_factory,
      shape,
      dtype,
      axis,
      keepdims,
      initial,
      inexact,
  ):
      np_op = getattr(np, name)
      jnp_op = getattr(jnp, name)
      rng = rng_factory(self.rng())
      is_bf16_nan_test = (
          dtype == jnp.bfloat16
          and rng_factory.__name__ == "rand_some_nan"
      )
  
      @jtu.ignore_warning(
          category=RuntimeWarning,
          message="Degrees of freedom <= 0 for slice.*",
      )
      @jtu.ignore_warning(category=NumpyComplexWarning)
      def np_fun(x):
          x = np.asarray(x)
          if inexact:
              x = x.astype(dtypes.to_inexact_dtype(x.dtype))
          x_cast = x if not is_bf16_nan_test else x.astype(np.float32)
          res = np_op(x_cast, axis, keepdims=keepdims, initial=initial)
          res = (
              res if not is_bf16_nan_test else res.astype(jnp.bfloat16)
          )
          return res.astype(_reducer_output_dtype(name, x.dtype))
  
      jnp_fun = lambda x: jnp_op(
          x, axis, keepdims=keepdims, initial=initial
      )
      jnp_fun = jtu.ignore_warning(category=jnp.ComplexWarning)(jnp_fun)
      args_maker = lambda: [rng(shape, dtype)]
      tol = {jnp.bfloat16: 3e-2}
      self._CheckAgainstNumpy(
          np_fun, jnp_fun, args_maker, rtol=tol, atol=tol
      )
      self._CompileAndCheck(jnp_fun, args_maker)
  
imports: import collections
  from functools import partial
  import itertools
  import unittest
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import jax
  from jax import numpy
  from jax._src import config
  from jax._src import dtypes
  from jax._src import test_util
  from jax._src.util import NumpyComplexWarning
label_desc: Use image node_id 5 for calling the JaxNumpyReducerTests obj's underlying member method code with example usage: obj.testReducerInitial(name, rng_factory, shape, dtype, axis, keepdims, initial, inexact) and returns: res