Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_roll2(self, xp, dtype):
x = testing.shaped_arange((5, 2), xp, dtype)
return xp.roll(x, 1)
def test_transpose_none(self, xp):
a = testing.shaped_arange((2, 3, 4), xp)
return a.transpose(None)
def test_take(self, xp, dtype):
a = testing.shaped_arange(self.shape, xp, dtype)
if self.axis is None:
m = a.size
else:
m = a.shape[self.axis]
i = testing.shaped_arange(self.indices_shape, xp, numpy.int32) % m
return wrap_take(a, i, self.axis)
def check_binary(self, name, xp, dtype):
a = testing.shaped_arange((2, 3), xp, dtype)
b = testing.shaped_reverse_arange((2, 3), xp, dtype)
return getattr(xp, name)(a, b)
def test_transposed_flatten(self, xp):
a = testing.shaped_arange((2, 3, 4), xp).transpose(2, 0, 1)
return a.flatten()
def test_external_sum_axis(self, xp, dtype):
a = testing.shaped_arange((2, 3, 4), xp, dtype)
return xp.sum(a, axis=1)
def test_c_1(self, xp, dtype):
a = testing.shaped_arange((4, 2), xp, dtype)
b = testing.shaped_reverse_arange((4, 3), xp, dtype)
return xp.c_[a, b]
def check_binary(self, name, xp, dtype, no_bool=False):
if no_bool and numpy.dtype(dtype).char == '?':
return numpy.int_(0)
a = testing.shaped_arange((2, 3), xp, dtype)
b = testing.shaped_reverse_arange((2, 3), xp, dtype)
return getattr(xp, name)(a, b)
def check_unary(self, name, xp, dtype):
a = testing.shaped_arange((2, 3), xp, dtype)
return getattr(xp, name)(a)
def test_multidim_vdot(self, xp, dtype):
a = testing.shaped_arange((2, 3, 4), xp, dtype)
b = testing.shaped_arange((2, 2, 2, 3), xp, dtype)
return xp.vdot(a, b)