@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_start_shape={}_stop_shape={}_num={}_endpoint={}_retstep={}_dtype={}'.format(start_shape, stop_shape, num, endpoint, retstep, dtype), 'start_shape': start_shape, 'stop_shape': stop_shape, 'num': num, 'endpoint': endpoint, 'retstep': retstep, 'dtype': dtype, 'rng_factory': rng_factory} for start_shape in [(), (2,), (2, 2)] for stop_shape in [(), (2,), (2, 2)] for num in [0, 1, 2, 5, 20] for endpoint in [True, False] for retstep in [True, False] for dtype in (number_dtypes + [None]) for rng_factory in [jtu.rand_default])))
def testLinspace(self, start_shape, stop_shape, num, endpoint, retstep, dtype, rng_factory):
    if ((num == 1) and (not endpoint) and (numpy_version < (1, 17, 5))):
        raise SkipTest('Numpy < 1.17.5 has a linspace bug.')
    rng = rng_factory()
    tol = (jtu.tolerance((dtype if dtype else onp.float32)) * 10)
    args_maker = self._GetArgsMaker(rng, [start_shape, stop_shape], [dtype, dtype])
    (start, stop) = args_maker()
    ndim = len(onp.shape((start + stop)))
    for axis in range((- ndim), ndim):
        jnp_op = (lambda start, stop: jnp.linspace(start, stop, num, endpoint=endpoint, retstep=retstep, dtype=dtype, axis=axis))
        onp_op = (lambda start, stop: onp.linspace(start, stop, num, endpoint=endpoint, retstep=retstep, dtype=dtype, axis=axis))
        self._CheckAgainstNumpy(onp_op, jnp_op, args_maker, check_dtypes=False, tol=tol)
        if (dtype in (inexact_dtypes + [None])):
            self._CompileAndCheck(jnp_op, args_maker, check_dtypes=False, atol=tol, rtol=tol)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': '_start_shape={}_stop_shape={}_num={}_endpoint={}_retstep={}_dtype={}'.format(start_shape, stop_shape, num, endpoint, retstep, dtype), 'start_shape': start_shape, 'stop_shape': stop_shape, 'num': num, 'endpoint': endpoint, 'retstep': retstep, 'dtype': dtype, 'rng_factory': rng_factory} for start_shape in [(), (2,), (2, 2)] for stop_shape in [(), (2,), (2, 2)] for num in [0, 1, 2, 5, 20] for endpoint in [True, False] for retstep in [True, False] for dtype in (number_dtypes + [None]) for rng_factory in [jtu.rand_default])))
def testLinspace(self, start_shape, stop_shape, num, endpoint, retstep, dtype, rng_factory):
    if ((num == 1) and (not endpoint) and (numpy_version < (1, 17, 5))):
        raise SkipTest('Numpy < 1.17.5 has a linspace bug.')
    rng = rng_factory()
    tol = (jtu.tolerance((dtype if dtype else onp.float32)) * 10)
    args_maker = self._GetArgsMaker(rng, [start_shape, stop_shape], [dtype, dtype])
    (start, stop) = args_maker()
    ndim = len(onp.shape((start + stop)))
    for axis in range((- ndim), ndim):
        jnp_op = (lambda start, stop: jnp.linspace(start, stop, num, endpoint=endpoint, retstep=retstep, dtype=dtype, axis=axis))
        onp_op = (lambda start, stop: onp.linspace(start, stop, num, endpoint=endpoint, retstep=retstep, dtype=dtype, axis=axis))
        self._CheckAgainstNumpy(onp_op, jnp_op, args_maker, check_dtypes=False, tol=tol)
        if (dtype in (inexact_dtypes + [None])):
            self._CompileAndCheck(jnp_op, args_maker, check_dtypes=False, atol=tol, rtol=tol)