@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_shape={}_dtype={}_out_dtype={}_axis={}_ddof={}_keepdims={}'.format(shape, dtype, out_dtype, axis, ddof, keepdims), 'shape': shape, 'dtype': dtype, 'out_dtype': out_dtype, 'axis': axis, 'ddof': ddof, 'keepdims': keepdims, 'rng_factory': rng_factory} for shape in [(5,), (10, 5)] for dtype in all_dtypes for out_dtype in inexact_dtypes for axis in [None, 0, (- 1)] for ddof in [0, 1, 2] for keepdims in [False, True] for rng_factory in [jtu.rand_default])))
def testVar(self, shape, dtype, out_dtype, axis, ddof, keepdims, rng_factory):
    rng = rng_factory()
    args_maker = self._GetArgsMaker(rng, [shape], [dtype])

    def onp_fun(x):
        out = onp.var(x.astype(jnp.promote_types(onp.float32, dtype)), axis=axis, ddof=ddof, keepdims=keepdims)
        return out.astype(out_dtype)
    jnp_fun = partial(jnp.var, dtype=out_dtype, axis=axis, ddof=ddof, keepdims=keepdims)
    tol = jtu.tolerance(out_dtype, {onp.float16: 0.1, onp.float32: 0.001, onp.float64: 0.001, onp.complex128: 1e-06})
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True, tol=tol)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True, rtol=tol, atol=tol)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_shape={}_dtype={}_out_dtype={}_axis={}_ddof={}_keepdims={}'.format(shape, dtype, out_dtype, axis, ddof, keepdims), 'shape': shape, 'dtype': dtype, 'out_dtype': out_dtype, 'axis': axis, 'ddof': ddof, 'keepdims': keepdims, 'rng_factory': rng_factory} for shape in [(5,), (10, 5)] for dtype in all_dtypes for out_dtype in inexact_dtypes for axis in [None, 0, (- 1)] for ddof in [0, 1, 2] for keepdims in [False, True] for rng_factory in [jtu.rand_default])))
def testVar(self, shape, dtype, out_dtype, axis, ddof, keepdims, rng_factory):
    rng = rng_factory()
    args_maker = self._GetArgsMaker(rng, [shape], [dtype])

    def onp_fun(x):
        out = onp.var(x.astype(jnp.promote_types(onp.float32, dtype)), axis=axis, ddof=ddof, keepdims=keepdims)
        return out.astype(out_dtype)
    jnp_fun = partial(jnp.var, dtype=out_dtype, axis=axis, ddof=ddof, keepdims=keepdims)
    tol = jtu.tolerance(out_dtype, {onp.float16: 0.1, onp.float32: 0.001, onp.float64: 0.001, onp.complex128: 1e-06})
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True, tol=tol)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True, rtol=tol, atol=tol)