Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@testing.numpy_cupy_array_equal()
def test_array_split1(self, xp):
a = testing.shaped_arange((3, 11), xp)
split = xp.array_split(a, 4, 1)
return xp.concatenate(split, 1)
@testing.numpy_cupy_array_equal()
def test_vsplit(self, xp):
a = testing.shaped_arange((12, 3), xp)
split = xp.vsplit(a, 4)
return xp.vstack(split)
@testing.numpy_cupy_array_equal()
def test_linspace_zero_num_no_endopoint_with_retstep(self, xp, dtype):
x, step = xp.linspace(0, 10, 0, dtype=dtype, endpoint=False,
retstep=True)
self.assertTrue(math.isnan(step))
return x
@testing.numpy_cupy_array_equal()
def check_binary_nan(self, name, xp, dtype):
a = xp.array([-3, numpy.NAN, -1, numpy.NAN, 0, numpy.NAN, 2],
dtype=dtype)
b = xp.array([numpy.NAN, numpy.NAN, 1, 0, numpy.NAN, -1, -2],
dtype=dtype)
return getattr(xp, name)(a, b)
@testing.numpy_cupy_array_equal()
def test_atleast_2d2(self, xp):
a = testing.shaped_arange((1, 3, 2), xp)
return xp.atleast_2d(a)
@testing.numpy_cupy_array_equal()
def test_rot90_none(self, xp, dtype):
x = testing.shaped_arange((3, 4), xp, dtype)
return xp.rot90(x, 0)
@testing.numpy_cupy_array_equal()
def test_take(self, xp, dtype):
a = testing.shaped_arange(self.shape, xp, dtype)
return wrap_take(a, self.indices, self.axis)
@testing.numpy_cupy_array_equal()
def test_scatter_add(self, xp, dtype):
a = xp.zeros(self.shape, dtype)
if xp is cupy:
a.scatter_add(self.slices, self.value)
else:
a[self.slices] = a[self.slices] + self.value
return a
@testing.numpy_cupy_array_equal()
def test_flip_1(self, xp, dtype):
x = testing.shaped_arange((3,), xp, dtype)
return xp.flip(x, 0)
@testing.numpy_cupy_array_equal()
def check_unary_nan(self, name, xp, dtype):
a = xp.array(
[-3, numpy.NAN, -1, numpy.NAN, 0, numpy.NAN, dtype('inf')],
dtype=dtype)
return getattr(xp, name)(a)