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_allclose()
def test_tensordot_with_int_axes(self, xp, dtype):
a = testing.shaped_arange((2, 3, 4, 5), xp, dtype)
b = testing.shaped_arange((3, 4, 5, 2), xp, dtype)
return xp.tensordot(a, b, axes=3)
@testing.numpy_cupy_allclose(atol=1.0)
def check_ipow_array(self, xp, x_type, y_type):
a = xp.array([[1, 2, 3], [4, 5, 6]], x_type)
b = xp.array([[6, 5, 4], [3, 2, 1]], y_type)
return operator.ipow(a, b)
@testing.numpy_cupy_allclose()
def test_external_prod_all(self, xp, dtype):
a = testing.shaped_arange((2, 3), xp, dtype)
return xp.prod(a)
@testing.numpy_cupy_allclose(atol=1e-5)
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)
@cupy.fuse()
def g(x, y):
return getattr(cupy, name)(x, y)
return g(a, b)
@testing.numpy_cupy_allclose()
def test_inner(self, xp, dtype):
a = testing.shaped_arange((5,), xp, dtype)
b = testing.shaped_reverse_arange((5,), xp, dtype)
return xp.inner(a, b)
@testing.numpy_cupy_allclose(atol=1e-5)
def check_unary_negative(self, name, xp, dtype, no_bool=False):
if no_bool and numpy.dtype(dtype).char == '?':
return numpy.int_(0)
a = xp.array([-3, -2, -1, 1, 2, 3], dtype=dtype)
return getattr(xp, name)(a)
@testing.numpy_cupy_allclose(atol=1e-5)
def check_unary_negative(self, name, xp, dtype):
a = xp.array([-3, -2, -1, 1, 2, 3], dtype=dtype)
return getattr(xp, name)(a)
@testing.numpy_cupy_allclose()
def test_argmin_axis1(self, xp, dtype):
a = testing.shaped_random((2, 3, 4), xp, dtype)
return a.argmin(axis=1)
@testing.numpy_cupy_allclose()
def test_external_argmax_axis_large(self, xp, dtype):
a = testing.shaped_random((3, 1000), xp, dtype)
return xp.argmax(a, axis=0)
@testing.numpy_cupy_allclose()
def test_transposed_tensordot(self, xp, dtype):
a = testing.shaped_arange((2, 3, 4), xp, dtype).transpose(1, 0, 2)
b = testing.shaped_arange((4, 3, 2), xp, dtype).transpose(2, 0, 1)
return xp.tensordot(a, b)