@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_shape={}_k={}'.format(jtu.format_shape_dtype_string(shape, dtype), k), 'dtype': dtype, 'shape': shape, 'k': k, 'rng_factory': jtu.rand_default} for dtype in default_dtypes for shape in [shape for shape in all_shapes if (len(shape) in (1, 2))] for k in list(range((- 4), 4)))))
def testDiag(self, shape, dtype, k, rng_factory):
    rng = rng_factory()
    onp_fun = (lambda arg: onp.diag(arg, k))
    jnp_fun = (lambda arg: jnp.diag(arg, k))
    args_maker = (lambda : [rng(shape, dtype)])
    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': '_shape={}_k={}'.format(jtu.format_shape_dtype_string(shape, dtype), k), 'dtype': dtype, 'shape': shape, 'k': k, 'rng_factory': jtu.rand_default} for dtype in default_dtypes for shape in [shape for shape in all_shapes if (len(shape) in (1, 2))] for k in list(range((- 4), 4)))))
def testDiag(self, shape, dtype, k, rng_factory):
    rng = rng_factory()
    onp_fun = (lambda arg: onp.diag(arg, k))
    jnp_fun = (lambda arg: jnp.diag(arg, k))
    args_maker = (lambda : [rng(shape, dtype)])
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)