@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_shape={}_axis={}_dtype={}'.format(shape, axis, dtype), 'shape': shape, 'axis': axis, 'dtype': dtype, 'rng_factory': rng_factory} for shape in [(10,), (10, 15), (10, 15, 20)] for _num_axes in range(len(shape)) for axis in itertools.combinations(range(len(shape)), _num_axes) for dtype in inexact_dtypes for rng_factory in [jtu.rand_default])))
def testGradient(self, shape, axis, dtype, rng_factory):
    rng = rng_factory()
    args_maker = self._GetArgsMaker(rng, [shape], [dtype])
    jnp_fun = (lambda y: jnp.gradient(y, axis=axis))
    onp_fun = (lambda y: onp.gradient(y, axis=axis))
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=False)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_shape={}_axis={}_dtype={}'.format(shape, axis, dtype), 'shape': shape, 'axis': axis, 'dtype': dtype, 'rng_factory': rng_factory} for shape in [(10,), (10, 15), (10, 15, 20)] for _num_axes in range(len(shape)) for axis in itertools.combinations(range(len(shape)), _num_axes) for dtype in inexact_dtypes for rng_factory in [jtu.rand_default])))
def testGradient(self, shape, axis, dtype, rng_factory):
    rng = rng_factory()
    args_maker = self._GetArgsMaker(rng, [shape], [dtype])
    jnp_fun = (lambda y: jnp.gradient(y, axis=axis))
    onp_fun = (lambda y: onp.gradient(y, axis=axis))
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=False)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)