@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_{}_decimals={}'.format(jtu.format_shape_dtype_string(shape, dtype), decimals), 'shape': shape, 'dtype': dtype, 'decimals': decimals, 'rng_factory': jtu.rand_default} for (shape, dtype) in _shape_and_dtypes(all_shapes, number_dtypes) for decimals in [0, 1, (- 2)])))
def testRoundStaticDecimals(self, shape, dtype, decimals, rng_factory):
    rng = rng_factory()
    if (jnp.issubdtype(dtype, onp.integer) and (decimals < 0)):
        self.skipTest('Integer rounding with decimals < 0 not implemented')
    onp_fun = (lambda x: onp.round(x, decimals=decimals))
    jnp_fun = (lambda x: jnp.round(x, decimals=decimals))
    args_maker = (lambda : [rng(shape, dtype)])
    tol = {jnp.bfloat16: 0.05, onp.float16: 0.01}
    check_dtypes = (shape is not jtu.PYTHON_SCALAR_SHAPE)
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=check_dtypes, tol=tol)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=check_dtypes, atol=tol, rtol=tol)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_{}_decimals={}'.format(jtu.format_shape_dtype_string(shape, dtype), decimals), 'shape': shape, 'dtype': dtype, 'decimals': decimals, 'rng_factory': jtu.rand_default} for (shape, dtype) in _shape_and_dtypes(all_shapes, number_dtypes) for decimals in [0, 1, (- 2)])))
def testRoundStaticDecimals(self, shape, dtype, decimals, rng_factory):
    rng = rng_factory()
    if (jnp.issubdtype(dtype, onp.integer) and (decimals < 0)):
        self.skipTest('Integer rounding with decimals < 0 not implemented')
    onp_fun = (lambda x: onp.round(x, decimals=decimals))
    jnp_fun = (lambda x: jnp.round(x, decimals=decimals))
    args_maker = (lambda : [rng(shape, dtype)])
    tol = {jnp.bfloat16: 0.05, onp.float16: 0.01}
    check_dtypes = (shape is not jtu.PYTHON_SCALAR_SHAPE)
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=check_dtypes, tol=tol)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=check_dtypes, atol=tol, rtol=tol)