@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_x1={}_x2={}_x1_rng={}'.format(jtu.format_shape_dtype_string(x1_shape, x1_dtype), jtu.format_shape_dtype_string(x2_shape, onp.int32), x1_rng_factory_id), 'x1_shape': x1_shape, 'x1_dtype': x1_dtype, 'x2_shape': x2_shape, 'x1_rng_factory': x1_rng_factory, 'x2_rng_factory': x2_rng_factory} for (x1_rng_factory_id, x1_rng_factory) in enumerate([jtu.rand_some_inf_and_nan, jtu.rand_some_zero]) for x2_rng_factory in [partial(jtu.rand_int, (- 1075), 1024)] for (x1_shape, x2_shape) in filter(_shapes_are_broadcast_compatible, CombosWithReplacement(array_shapes, 2)) for x1_dtype in default_dtypes)))
@jtu.skip_on_devices('tpu')
def testLdexp(self, x1_shape, x1_dtype, x2_shape, x1_rng_factory, x2_rng_factory):
    if ((x1_dtype not in [jnp.bfloat16, onp.float16, onp.float32]) and (not FLAGS.jax_enable_x64)):
        self.skipTest('Only run float64 testcase when float64 is enabled.')
    x1_rng = x1_rng_factory()
    x2_rng = x2_rng_factory()
    onp_fun = (lambda x1, x2: onp.ldexp(x1, x2))
    onp_fun = jtu.ignore_warning(category=RuntimeWarning, message='overflow.*')(onp_fun)
    jnp_fun = (lambda x1, x2: jnp.ldexp(x1, x2))
    args_maker = (lambda : [x1_rng(x1_shape, x1_dtype), x2_rng(x2_shape, onp.int32)])
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_x1={}_x2={}_x1_rng={}'.format(jtu.format_shape_dtype_string(x1_shape, x1_dtype), jtu.format_shape_dtype_string(x2_shape, onp.int32), x1_rng_factory_id), 'x1_shape': x1_shape, 'x1_dtype': x1_dtype, 'x2_shape': x2_shape, 'x1_rng_factory': x1_rng_factory, 'x2_rng_factory': x2_rng_factory} for (x1_rng_factory_id, x1_rng_factory) in enumerate([jtu.rand_some_inf_and_nan, jtu.rand_some_zero]) for x2_rng_factory in [partial(jtu.rand_int, (- 1075), 1024)] for (x1_shape, x2_shape) in filter(_shapes_are_broadcast_compatible, CombosWithReplacement(array_shapes, 2)) for x1_dtype in default_dtypes)))
@jtu.skip_on_devices('tpu')
def testLdexp(self, x1_shape, x1_dtype, x2_shape, x1_rng_factory, x2_rng_factory):
    if ((x1_dtype not in [jnp.bfloat16, onp.float16, onp.float32]) and (not FLAGS.jax_enable_x64)):
        self.skipTest('Only run float64 testcase when float64 is enabled.')
    x1_rng = x1_rng_factory()
    x2_rng = x2_rng_factory()
    onp_fun = (lambda x1, x2: onp.ldexp(x1, x2))
    onp_fun = jtu.ignore_warning(category=RuntimeWarning, message='overflow.*')(onp_fun)
    jnp_fun = (lambda x1, x2: jnp.ldexp(x1, x2))
    args_maker = (lambda : [x1_rng(x1_shape, x1_dtype), x2_rng(x2_shape, onp.int32)])
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)