How to use the cupy.testing.numpy_cupy_allclose 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 / linalg_tests / test_product.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / core_tests / test_ndarray_elementwise_op.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / math_tests / test_sumprod.py View on Github external
    @testing.numpy_cupy_allclose()
    def test_external_prod_all(self, xp, dtype):
        a = testing.shaped_arange((2, 3), xp, dtype)
        return xp.prod(a)
github chainer / chainer / tests / cupy_tests / core_tests / test_fusion.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / linalg_tests / test_product.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / math_tests / test_misc.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / math_tests / test_rounding.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / sorting_tests / test_search.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / sorting_tests / test_search.py View on Github external
    @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)
github chainer / chainer / tests / cupy_tests / linalg_tests / test_product.py View on Github external
    @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)