@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_arg{}_ndmin={}'.format(i, ndmin), 'arg': arg, 'ndmin': ndmin, 'dtype': dtype} for (i, (arg, dtype)) in enumerate([([True, False, True], jnp.bool_), (3.0, jnp.float_), ([1, 2, 3], jnp.int_), ([1.0, 2.0, 3.0], jnp.float_), ([[1, 2], [3, 4], [5, 6]], jnp.int_), ([[1, 2.0], [3, 4], [5, 6]], jnp.float_), ([[1.0, 2j], [3.0, 4.0], [5.0, 6.0]], jnp.complex_), ([[3, onp.array(2, dtype=jnp.float_), 1], onp.arange(3.0, dtype=jnp.float_)], jnp.float_)]) for ndmin in [None, onp.ndim(arg), (onp.ndim(arg) + 1), (onp.ndim(arg) + 2)])))
def testArray(self, arg, ndmin, dtype):
    args_maker = (lambda : [arg])
    dtype = dtypes.canonicalize_dtype(dtype)
    if (ndmin is not None):
        onp_fun = partial(onp.array, ndmin=ndmin, dtype=dtype)
        jnp_fun = partial(jnp.array, ndmin=ndmin)
    else:
        onp_fun = partial(onp.array, dtype=dtype)
        jnp_fun = jnp.array
    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': '_arg{}_ndmin={}'.format(i, ndmin), 'arg': arg, 'ndmin': ndmin, 'dtype': dtype} for (i, (arg, dtype)) in enumerate([([True, False, True], jnp.bool_), (3.0, jnp.float_), ([1, 2, 3], jnp.int_), ([1.0, 2.0, 3.0], jnp.float_), ([[1, 2], [3, 4], [5, 6]], jnp.int_), ([[1, 2.0], [3, 4], [5, 6]], jnp.float_), ([[1.0, 2j], [3.0, 4.0], [5.0, 6.0]], jnp.complex_), ([[3, onp.array(2, dtype=jnp.float_), 1], onp.arange(3.0, dtype=jnp.float_)], jnp.float_)]) for ndmin in [None, onp.ndim(arg), (onp.ndim(arg) + 1), (onp.ndim(arg) + 2)])))
def testArray(self, arg, ndmin, dtype):
    args_maker = (lambda : [arg])
    dtype = dtypes.canonicalize_dtype(dtype)
    if (ndmin is not None):
        onp_fun = partial(onp.array, ndmin=ndmin, dtype=dtype)
        jnp_fun = partial(jnp.array, ndmin=ndmin)
    else:
        onp_fun = partial(onp.array, dtype=dtype)
        jnp_fun = jnp.array
    self._CheckAgainstNumpy(onp_fun, jnp_fun, args_maker, check_dtypes=True)
    self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)