How to use the cupy.testing.numpy_cupy_array_equal 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_split.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / manipulation_tests / test_split.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / creation_tests / test_ranges.py View on Github external
    @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
github chainer / chainer / tests / cupy_tests / math_tests / test_misc.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / manipulation_tests / test_dims.py View on Github external
    @testing.numpy_cupy_array_equal()
    def test_atleast_2d2(self, xp):
        a = testing.shaped_arange((1, 3, 2), xp)
        return xp.atleast_2d(a)
github chainer / chainer / tests / cupy_tests / manipulation_tests / test_rearrange.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / core_tests / test_ndarray.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / core_tests / test_ndarray_scatter.py View on Github external
    @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
github chainer / chainer / tests / cupy_tests / manipulation_tests / test_rearrange.py View on Github external
    @testing.numpy_cupy_array_equal()
    def test_flip_1(self, xp, dtype):
        x = testing.shaped_arange((3,), xp, dtype)
        return xp.flip(x, 0)
github chainer / chainer / tests / cupy_tests / logic_tests / test_content.py View on Github external
    @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)