How to use the cupy.testing.shaped_arange function in cupy

To help you get started, we’ve selected a few cupy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chainer / chainer / tests / cupy_tests / manipulation_tests / test_rearrange.py View on Github external
def test_roll2(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1)
github chainer / chainer / tests / cupy_tests / manipulation_tests / test_transpose.py View on Github external
def test_transpose_none(self, xp):
        a = testing.shaped_arange((2, 3, 4), xp)
        return a.transpose(None)
github chainer / chainer / tests / cupy_tests / core_tests / test_ndarray.py View on Github external
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)
github chainer / chainer / tests / cupy_tests / logic_tests / test_comparison.py View on Github external
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)
github chainer / chainer / tests / cupy_tests / core_tests / test_ndarray_copy_and_view.py View on Github external
def test_transposed_flatten(self, xp):
        a = testing.shaped_arange((2, 3, 4), xp).transpose(2, 0, 1)
        return a.flatten()
github chainer / chainer / tests / cupy_tests / math_tests / test_sumprod.py View on Github external
def test_external_sum_axis(self, xp, dtype):
        a = testing.shaped_arange((2, 3, 4), xp, dtype)
        return xp.sum(a, axis=1)
github chainer / chainer / tests / cupy_tests / indexing_tests / test_generate.py View on Github external
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]
github chainer / chainer / tests / cupy_tests / math_tests / test_misc.py View on Github external
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)
github chainer / chainer / tests / cupy_tests / math_tests / test_trigonometric.py View on Github external
def check_unary(self, name, xp, dtype):
        a = testing.shaped_arange((2, 3), xp, dtype)
        return getattr(xp, name)(a)
github chainer / chainer / tests / cupy_tests / linalg_tests / test_product.py View on Github external
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)