Module ImportFrom alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body TryExcept body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Assign NameStore NameLoad handlers ExceptHandler type NameLoad name NameStore body Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad body If BoolOpAnd CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Str orelse If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad orelse If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad orelse If CompareIsNot Call NameLoad NameLoad Call NameLoad NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse If UnaryOpNot NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore ListComp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr CompareIn NameLoad NameLoad For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad AttributeLoad NameLoad attr Assign NameStore CompareGtE Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad Num Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Return BoolOpAnd Call NameLoad GeneratorExp CompareIn NameLoad NameLoad comprehension NameStore NameLoad Call NameLoad GeneratorExp CompareIn NameLoad NameLoad comprehension NameStore BinOpAdd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad If BoolOpOr NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Return If Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Expr Call NameLoad NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num Str NameLoad Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Str NameLoad Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Num NameLoad Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str NameLoad Str body Expr Str FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad Str NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults Str body Expr Str FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body Assign SubscriptStore NameLoad Index NameLoad NameLoad TryExcept body Expr Call NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad Assign NameStore NameLoad handlers ExceptHandler type NameLoad name NameStore body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index NameLoad NameLoad TryExcept body Expr Call NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad Assign NameStore NameLoad handlers ExceptHandler type NameLoad name NameStore body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad decorator_list Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body For NameStore NameLoad body TryExcept body Assign SubscriptStore NameLoad Index NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call NameLoad NameLoad Str NameLoad Raise decorator_list Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list Return NameLoad decorator_list Assign NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore BinOpAdd NameLoad TupleLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad GeneratorExp AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr comprehension NameStore Str Assign NameStore Call NameLoad GeneratorExp AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr comprehension NameStore Str Assign NameStore BinOpAdd NameLoad NameLoad Assign NameStore BinOpAdd NameLoad TupleLoad AttributeLoad NameLoad attr Assign NameStore BinOpAdd NameLoad NameLoad Assign NameStore BinOpAdd NameLoad NameLoad FunctionDef arguments args NameParam NameParam defaults body If NameLoad body If NameLoad body Return BinOpAdd NameLoad NameLoad orelse Return NameLoad orelse If NameLoad body Return BinOpAdd NameLoad NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str NameLoad NameLoad body Expr Str Return Call NameLoad Call NameLoad NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str NameLoad body Expr Str If NameLoad body Return Call NameLoad NameLoad keyword NameLoad orelse Return Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults Str body Expr Str Return Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults Str body Expr Str Return Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str NameLoad body Expr Str If NameLoad body Return Call NameLoad NameLoad keyword NameLoad orelse Return Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults ListLoad Str NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore CompareNotEq Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Str Num If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr DictComp NameLoad NameLoad comprehension NameStore NameLoad orelse Assign NameStore ListLoad For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListComp Call NameLoad Call NameLoad NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad TryExcept body Expr Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call NameLoad NameLoad Raise decorator_list Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults ListLoad Str NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults ListLoad Str NameLoad body Expr Str Return Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults ListLoad Str NameLoad body Expr Str Return Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults ListLoad Str NameLoad NameLoad body Expr Str If NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad Return Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults vararg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad AttributeLoad NameLoad attr body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num BinOpAdd Call AttributeLoad NameLoad attr NameLoad Num Num If CompareEq AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Call AttributeLoad CompareEq BinOpMod NameLoad Num Num attr NameLoad orelse Return Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad AttributeLoad NameLoad attr body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num If CompareEq AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Call AttributeLoad CompareEq BinOpMod NameLoad Num Num attr NameLoad orelse Return Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad AttributeLoad NameLoad attr Num Num body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareEq AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr Num keyword NameLoad attr NameLoad orelse Return Call AttributeLoad NameLoad attr Call AttributeLoad BinOpMult Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults kwarg body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A __future__ print_function N/A functools N/A os N/A pkg_resources N/A random N/A traceback N/A unittest N/A numpy N/A cupy cupy internal cupy.testing array cupy.testing parameterized _call_func N/A N/A self impl args kw N/A N/A N/A N/A N/A result N/A impl self args kw N/A N/A N/A self assertIsNotNone result N/A error None N/A tb None N/A N/A N/A Exception N/A e N/A N/A result None N/A error e N/A tb N/A N/A traceback format_exc N/A N/A result error tb N/A _check_cupy_numpy_error N/A N/A self cupy_error cupy_tb numpy_error numpy_tb accept_error N/A True N/A N/A N/A N/A cupy_error None N/A numpy_error None N/A N/A N/A N/A self fail Both cupy and numpy are expected to raise errors, but not N/A N/A N/A cupy_error None N/A N/A N/A N/A self fail N/A Only numpy raises error

 numpy_tb N/A N/A N/A numpy_error None N/A N/A N/A N/A self fail N/A Only cupy raises error

 cupy_tb N/A N/A N/A N/A type cupy_error N/A type numpy_error N/A N/A msg N/A Differnet types of errors occurred

cupy
%s
numpy
%s
 N/A cupy_tb numpy_tb N/A N/A N/A self fail msg N/A N/A N/A accept_error N/A N/A msg N/A Both cupy and numpy raise exceptions

cupy
%s
numpy
%s
 N/A cupy_tb numpy_tb N/A N/A N/A self fail msg N/A _make_positive_indices N/A N/A self impl args kw N/A N/A N/A ks N/A k N/A N/A k v N/A N/A kw items N/A v _unsigned_dtypes N/A k ks N/A N/A N/A kw N/A k N/A numpy intp N/A mask N/A N/A N/A cupy asnumpy N/A impl self args kw 0 N/A N/A N/A numpy nonzero mask N/A _contains_signed_and_unsigned N/A N/A kw N/A N/A N/A vs N/A set N/A N/A kw values N/A N/A N/A any N/A N/A d vs N/A d _unsigned_dtypes N/A any N/A N/A d vs N/A d N/A _float_dtypes _signed_dtypes N/A _make_decorator N/A N/A check_func name type_check accept_error N/A N/A decorator N/A N/A impl N/A N/A test_func N/A N/A self N/A args kw N/A N/A N/A kw N/A name cupy N/A N/A cupy_result cupy_error cupy_tb N/A _call_func self impl args kw N/A N/A kw N/A name numpy N/A N/A numpy_result numpy_error numpy_tb N/A _call_func self impl args kw N/A N/A cupy_error numpy_error N/A N/A N/A _check_cupy_numpy_error self cupy_error cupy_tb numpy_error numpy_tb accept_error accept_error N/A N/A N/A _contains_signed_and_unsigned kw N/A N/A inds N/A _make_positive_indices self impl args kw N/A cupy_result N/A N/A N/A cupy asnumpy cupy_result N/A inds N/A numpy_result N/A N/A N/A cupy asnumpy numpy_result N/A inds N/A N/A check_func cupy_result numpy_result N/A type_check N/A N/A N/A N/A self assertEqual N/A cupy_result dtype N/A numpy_result dtype N/A N/A N/A functools wraps impl N/A test_func N/A N/A decorator N/A numpy_cupy_allclose N/A N/A rtol atol err_msg verbose name type_check accept_error N/A 1e-07 0 True xp True True N/A N/A Decorator that checks NumPy results and CuPy ones are close.

    Args:
         rtol(float): Relative tolerance.
         atol(float): Absolute tolerance
         err_msg(str): The error message to be printed in case of failure.
         verbose(bool): If ``True``, the conflicting values are
             appended to the error message.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the arrays whose values are
    close between ``numpy`` case and ``cupy`` case.
    For example, this test case checks ``numpy.zeros`` and ``cupy.zeros``
    should return same value.

    >>> from cupy import testing
    ... @testing.gpu
    ... class TestFoo(unittest.TestCase):
    ...
    ...     @testing.numpy_cupy_allclose()
    ...     def test_foo(self, xp):
    ...         # ...
    ...         # Prepare data with xp
    ...         # ...
    ...
    ...         xp_result = xp.zeros(10)
    ...         return xp_result

    .. seealso:: :func:`cupy.testing.assert_allclose`
     check_func N/A N/A cupy_result numpy_result N/A N/A N/A N/A N/A array assert_allclose cupy_result numpy_result rtol atol err_msg verbose N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_array_almost_equal N/A N/A decimal err_msg verbose name type_check accept_error N/A 6 True xp True True N/A N/A Decorator that checks NumPy results and CuPy ones are almost equal.

    Args:
         decimal(int): Desired precision.
         err_msg(str): The error message to be printed in case of failure.
         verbose(bool): If ``True``, the conflicting values
             are appended to the error message.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the same arrays
    in the sense of :func:`cupy.testing.assert_array_almost_equal`
    (except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_almost_equal`
     check_func N/A N/A x y N/A N/A N/A N/A N/A array assert_array_almost_equal x y decimal err_msg verbose N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_array_almost_equal_nulp N/A N/A nulp name type_check accept_error N/A 1 xp True True N/A N/A Decorator that checks results of NumPy and CuPy are equal w.r.t. spacing.

    Args:
         nulp(int): The maximum number of unit in the last place for tolerance.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the same arrays
    in the sense of :func:`cupy.testing.assert_array_almost_equal_nulp`
    (except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_almost_equal_nulp`
     check_func N/A N/A x y N/A N/A N/A N/A N/A array assert_array_almost_equal_nulp x y nulp N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_array_max_ulp N/A N/A maxulp dtype name type_check accept_error N/A 1 None xp True True N/A N/A Decorator that checks results of NumPy and CuPy ones are equal w.r.t. ulp.

    Args:
         maxulp(int): The maximum number of units in the last place
             that elements of resulting two arrays can differ.
         dtype(numpy.dtype): Data-type to convert the resulting
             two array to if given.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the same arrays
    in the sense of :func:`assert_array_max_ulp`
    (except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_max_ulp`

     check_func N/A N/A x y N/A N/A N/A N/A N/A array assert_array_max_ulp x y maxulp dtype N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_array_equal N/A N/A err_msg verbose name type_check accept_error N/A True xp True True N/A N/A Decorator that checks NumPy results and CuPy ones are equal.

    Args:
         err_msg(str): The error message to be printed in case of failure.
         verbose(bool): If ``True``, the conflicting values are
             appended to the error message.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the same arrays
    in the sense of :func:`numpy_cupy_array_equal`
    (except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_equal`
     check_func N/A N/A x y N/A N/A N/A N/A N/A array assert_array_equal x y err_msg verbose N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_array_list_equal N/A N/A err_msg verbose name N/A True xp N/A N/A Decorator that checks the resulting lists of NumPy and CuPy's one are equal.

    Args:
         err_msg(str): The error message to be printed in case of failure.
         verbose(bool): If ``True``, the conflicting values are appended
             to the error message.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.

    Decorated test fixture is required to return the same list of arrays
    (except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_list_equal`
     decorator N/A N/A impl N/A N/A test_func N/A N/A self N/A args kw N/A N/A N/A kw N/A name cupy N/A x N/A impl self args kw N/A N/A kw N/A name numpy N/A y N/A impl self args kw N/A N/A N/A self assertIsNotNone x N/A N/A N/A self assertIsNotNone y N/A N/A N/A array assert_array_list_equal x y err_msg verbose N/A N/A N/A functools wraps impl N/A test_func N/A N/A decorator N/A numpy_cupy_array_less N/A N/A err_msg verbose name type_check accept_error N/A True xp True True N/A N/A Decorator that checks the CuPy result is less than NumPy result.

    Args:
         err_msg(str): The error message to be printed in case of failure.
         verbose(bool): If ``True``, the conflicting values are
             appended to the error message.
         name(str): Argument name whose value is either
             ``numpy`` or ``cupy`` module.
         type_check(bool): If ``True``, consistency of dtype is also checked.
         accept_error(bool): If ``True``, errors are not raised as long as
             the errors occurred are identical between NumPy and CuPy.

    Decorated test fixture is required to return the smaller array
    when ``xp`` is ``cupy`` than the one when ``xp`` is ``numpy``.

    .. seealso:: :func:`cupy.testing.assert_array_less`
     check_func N/A N/A x y N/A N/A N/A N/A N/A array assert_array_less x y err_msg verbose N/A N/A N/A _make_decorator check_func name type_check accept_error N/A numpy_cupy_raises N/A N/A name N/A xp N/A N/A Decorator that checks the NumPy and CuPy throw same errors.

    Args:
         name(str): Argument name whose value is either
         ``numpy`` or ``cupy`` module.

    Decorated test fixture is required throw same errors
    even if ``xp`` is ``numpy`` or ``cupy``.

    .. seealso:: :func:`cupy.testing.assert_array_less`
     decorator N/A N/A impl N/A N/A test_func N/A N/A self N/A args kw N/A N/A N/A kw N/A name cupy N/A N/A N/A N/A impl self args kw N/A cupy_error None N/A cupy_tb None N/A N/A N/A Exception N/A e N/A N/A cupy_error e N/A cupy_tb N/A N/A traceback format_exc N/A N/A kw N/A name numpy N/A N/A N/A N/A impl self args kw N/A numpy_error None N/A numpy_tb None N/A N/A N/A Exception N/A e N/A N/A numpy_error e N/A numpy_tb N/A N/A traceback format_exc N/A N/A _check_cupy_numpy_error self cupy_error cupy_tb numpy_error numpy_tb accept_error True N/A N/A N/A functools wraps impl N/A test_func N/A N/A decorator N/A for_dtypes N/A N/A dtypes name N/A dtype N/A N/A Decorator for parameterized dtype test.

    Args:
         dtypes(list of dtypes): dtypes to be tested.
         name(str): Argument name to which specified dtypes are passed.

    This decorator adds a keyword argument specified by ``name``
    to the test fixture. Then, it runs the fixtures in parallel
    by passing the each element of ``dtypes`` to the named
    argument.
     decorator N/A N/A impl N/A N/A test_func N/A N/A self N/A args kw N/A N/A dtype dtypes N/A N/A N/A N/A N/A kw N/A name dtype N/A N/A impl self args kw N/A N/A N/A Exception N/A N/A N/A print name is dtype N/A N/A N/A N/A functools wraps impl N/A test_func N/A N/A decorator N/A N/A _regular_float_dtypes N/A N/A numpy float64 N/A numpy float32 N/A _float_dtypes N/A _regular_float_dtypes N/A N/A numpy float16 N/A _signed_dtypes N/A tuple N/A N/A N/A N/A numpy dtype i type N/A i bhilq N/A _unsigned_dtypes N/A tuple N/A N/A N/A N/A numpy dtype i type N/A i BHILQ N/A _int_dtypes N/A _signed_dtypes _unsigned_dtypes N/A _int_bool_dtypes N/A _int_dtypes N/A N/A numpy bool_ N/A _regular_dtypes N/A _regular_float_dtypes _int_bool_dtypes N/A _dtypes N/A _float_dtypes _int_bool_dtypes _make_all_dtypes N/A N/A no_float16 no_bool N/A N/A N/A no_float16 N/A N/A no_bool N/A N/A N/A _regular_float_dtypes _int_dtypes N/A N/A _regular_dtypes N/A N/A no_bool N/A N/A N/A _float_dtypes _int_dtypes N/A N/A _dtypes N/A for_all_dtypes N/A N/A name no_float16 no_bool N/A dtype False False N/A N/A Decorator that checks the fixture with all dtypes.

    Args:
         name(str): Argument name to which specified dtypes are passed.
         no_float16(bool): If, True, ``numpy.float16`` is
             omitted from candidate dtypes.
         no_bool(bool): If, True, ``numpy.bool_`` is
             omitted from candidate dtypes.

    dtypes to be tested: ``numpy.float16`` (optional), ``numpy.float32``,
    ``numpy.float64``, ``numpy.dtype('b')``, ``numpy.dtype('h')``,
    ``numpy.dtype('i')``, ``numpy.dtype('l')``, ``numpy.dtype('q')``,
    ``numpy.dtype('B')``, ``numpy.dtype('H')``, ``numpy.dtype('I')``,
    ``numpy.dtype('L')``, ``numpy.dtype('Q')``, and ``numpy.bool_`` (optional).

    The usage is as follows.
    This test fixture checks if ``cPickle`` successfully reconstructs
    :class:`cupy.ndarray` for various dtypes.
    ``dtype`` is an argument inserted by the decorator.

    >>> from cupy import testing
    >>> @testing.gpu
    ... class TestNpz(unittest.TestCase):
    ...
    ...     @testing.for_all_dtypes()
    ...     def test_pickle(self, dtype):
    ...         a = testing.shaped_arange((2, 3, 4), dtype=dtype)
    ...         s = six.moves.cPickle.dumps(a)
    ...         b = six.moves.cPickle.loads(s)
    ...         testing.assert_array_equal(a, b)

    Typically, we use this decorator in combination with
    decorators that check consistency between NumPy and CuPy like
    :func:`cupy.testing.numpy_cupy_allclose`.
    The following is such an example.

    >>> from cupy import testing
    >>> @testing.gpu
    ... class TestMean(unittest.TestCase):
    ...
    ...     @testing.for_all_dtypes()
    ...     @testing.numpy_cupy_allclose()
    ...     def test_mean_all(self, xp, dtype):
    ...         a = testing.shaped_arange((2, 3), xp, dtype)
    ...         return a.mean()

    .. seealso:: :func:`cupy.testing.for_dtypes`
     N/A N/A for_dtypes N/A _make_all_dtypes no_float16 no_bool name name N/A for_float_dtypes N/A N/A name no_float16 N/A dtype False N/A N/A Decorator that checks the fixture with all float dtypes.

    Args:
         name(str): Argument name to which specified dtypes are passed.
         no_float16(bool): If, True, ``numpy.float16`` is
             omitted from candidate dtypes.

    dtypes to be tested are ``numpy.float16`` (optional), ``numpy.float32``,
    and ``numpy.float64``.

    .. seealso:: :func:`cupy.testing.for_dtypes`,
        :func:`cupy.testing.for_all_dtypes`
     N/A no_float16 N/A N/A N/A for_dtypes _regular_float_dtypes name name N/A N/A N/A for_dtypes _float_dtypes name name N/A for_signed_dtypes N/A N/A name N/A dtype N/A N/A Decorator that checks the fixture with signed dtypes.

    Args:
         name(str): Argument name to which specified dtypes are passed.

    dtypes to be tested are ``numpy.dtype('b')``, ``numpy.dtype('h')``,
    ``numpy.dtype('i')``, ``numpy.dtype('l')``, and ``numpy.dtype('q')``.

    .. seealso:: :func:`cupy.testing.for_dtypes`,
        :func:`cupy.testing.for_all_dtypes`
     N/A N/A for_dtypes _signed_dtypes name name N/A for_unsigned_dtypes N/A N/A name N/A dtype N/A N/A Decorator that checks the fixture with all dtypes.

    Args:
         name(str): Argument name to which specified dtypes are passed.

    dtypes to be tested are ``numpy.dtype('B')``, ``numpy.dtype('H')``,

     ``numpy.dtype('I')``, ``numpy.dtype('L')``, and ``numpy.dtype('Q')``.

    .. seealso:: :func:`cupy.testing.for_dtypes`,
        :func:`cupy.testing.for_all_dtypes`
     N/A N/A for_dtypes _unsigned_dtypes name name N/A for_int_dtypes N/A N/A name no_bool N/A dtype False N/A N/A Decorator that checks the fixture with integer and optionally bool dtypes.

    Args:
         name(str): Argument name to which specified dtypes are passed.
         no_bool(bool): If ``True``, ``numpy.bool_`` is
             omitted from candidate dtypes.

    dtypes to be tested are ``numpy.dtype('b')``, ``numpy.dtype('h')``,
    ``numpy.dtype('i')``, ``numpy.dtype('l')``, ``numpy.dtype('q')``,
    ``numpy.dtype('B')``, ``numpy.dtype('H')``, ``numpy.dtype('I')``,
    ``numpy.dtype('L')``, ``numpy.dtype('Q')``, and ``numpy.bool_`` (optional).

    .. seealso:: :func:`cupy.testing.for_dtypes`,
        :func:`cupy.testing.for_all_dtypes`
     N/A no_bool N/A N/A N/A for_dtypes _int_dtypes name name N/A N/A N/A for_dtypes _int_bool_dtypes name name N/A for_dtypes_combination N/A N/A types names full N/A N/A dtype None N/A N/A Decorator that checks the fixture with a product set of dtypes.

    Args:
         types(list of dtypes): dtypes to be tested.
         names(list of str): Argument names to which dtypes are passed.
         full(bool): If ``True``, then all combinations
             of dtypes will be tested.
             Otherwise, the subset of combinations will be tested
             (see the description below).

    Decorator adds the keyword arguments specified by ``names``
    to the test fixture. Then, it runs the fixtures in parallel
    with passing (possibly a subset of) the product set of dtypes.
    The range of dtypes is specified by ``types``.

    The combination of dtypes to be tested changes depending
    on the option ``full``. If ``full`` is ``True``,
    all combinations of ``types`` are tested.
    Sometimes, such an exhaustive test can be costly.
    So, if ``full`` is ``False``, only the subset of possible
    combinations is tested. Specifically, at first,
    the shuffled lists of ``types`` are made for each argument
    name in ``names``.
    Let the lists be ``D1``, ``D2``, ..., ``Dn``
    where :math:`n` is the number of arguments.
    Then, the combinations to be tested will be ``zip(D1, ..., Dn)``.
    If ``full`` is ``None``, the behavior is switched
    by setting the environment variable ``CUPY_TEST_FULL_COMBINATION=1``.

    For example, let ``types`` be ``[float16, float32, float64]``
    and ``names`` be ``['a_type', 'b_type']``. If ``full`` is ``True``,
    then the decorated test fixture is executed with all
    :math:`2^3` patterns. On the other hand, if ``full`` is ``False``,
    shuffled lists are made for ``a_type`` and ``b_type``.
    Suppose the lists are ``(16, 64, 32)`` for ``a_type`` and
    ``(32, 64, 16)`` for ``b_type`` (prefixes are removed for short).
    Then the combinations of ``(a_type, b_type)`` to be tested are
    ``(16, 32)``, ``(64, 64)`` and ``(32, 16)``.
     N/A N/A full None N/A N/A full N/A N/A int N/A N/A N/A os environ get CUPY_TEST_FULL_COMBINATION 0 0 N/A full N/A N/A combination N/A N/A parameterized product N/A name types N/A name names N/A N/A ts N/A N/A _ N/A range N/A len names N/A N/A t N/A list types N/A N/A N/A random shuffle t N/A N/A N/A ts append t N/A combination N/A N/A dict N/A zip names typs N/A typs N/A zip ts decorator N/A N/A impl N/A N/A test_func N/A N/A self N/A args kw N/A N/A dtypes combination N/A N/A kw_copy N/A N/A kw copy N/A N/A N/A kw_copy update dtypes N/A N/A N/A N/A impl self args kw_copy N/A N/A N/A Exception N/A N/A N/A print dtypes N/A N/A N/A N/A functools wraps impl N/A test_func N/A N/A decorator N/A for_all_dtypes_combination N/A N/A names no_float16 no_bool full N/A N/A dtyes False False None N/A N/A Decorator that checks the fixture with a product set of all dtypes.

    Args:
         names(list of str): Argument names to which dtypes are passed.
         no_float16(bool): If ``True``, ``numpy.float16`` is
             omitted from candidate dtypes.
         no_bool(bool): If ``True``, ``numpy.bool_`` is
             omitted from candidate dtypes.
         full(bool): If ``True``, then all combinations of dtypes
             will be tested.
             Otherwise, the subset of combinations will be tested
             (see description in :func:`cupy.testing.for_dtypes_combination`).

    .. seealso:: :func:`cupy.testing.for_dtypes_combination`
     N/A types N/A _make_all_dtypes no_float16 no_bool N/A N/A for_dtypes_combination types names full N/A for_signed_dtypes_combination N/A N/A names full N/A N/A dtype None N/A N/A Decorator for parameterized test w.r.t. the product set of signed dtypes.

    Args:
         names(list of str): Argument names to which dtypes are passed.
         full(bool): If ``True``, then all combinations of dtypes
             will be tested.
             Otherwise, the subset of combinations will be tested
             (see description in :func:`cupy.testing.for_dtypes_combination`).

    .. seealso:: :func:`cupy.testing.for_dtypes_combination`
     N/A N/A for_dtypes_combination _signed_dtypes names names full full N/A for_unsigned_dtypes_combination N/A N/A names full N/A N/A dtype None N/A N/A Decorator for parameterized test w.r.t. the product set of unsigned dtypes.

    Args:
         names(list of str): Argument names to which dtypes are passed.
         full(bool): If ``True``, then all combinations of dtypes
             will be tested.
             Otherwise, the subset of combinations will be tested
             (see description in :func:`cupy.testing.for_dtypes_combination`).

    .. seealso:: :func:`cupy.testing.for_dtypes_combination`
     N/A N/A for_dtypes_combination _unsigned_dtypes names names full full N/A for_int_dtypes_combination N/A N/A names no_bool full N/A N/A dtype False None N/A N/A Decorator for parameterized test w.r.t. the product set of int and boolean.

    Args:
         names(list of str): Argument names to which dtypes are passed.
         no_bool(bool): If ``True``, ``numpy.bool_`` is
             omitted from candidate dtypes.
         full(bool): If ``True``, then all combinations of dtypes
             will be tested.
             Otherwise, the subset of combinations will be tested
             (see description in :func:`cupy.testing.for_dtypes_combination`).

    .. seealso:: :func:`cupy.testing.for_dtypes_combination`
     N/A no_bool N/A N/A types _int_dtypes N/A N/A types _int_bool_dtypes N/A N/A for_dtypes_combination types names full N/A with_requires N/A N/A N/A requirements N/A N/A Run a test case only when given requirements are satisfied.

    .. admonition:: Example

       This test case runs only when `numpy>=1.10` is installed.

       >>> from cupy import testing
       ... class Test(unittest.TestCase):
       ...     @testing.with_requires('numpy>=1.10')
       ...     def test_for_numpy_1_10(self):
       ...         pass

    Args:
        requirements: A list of string representing requirement condition to
            run a given test case.

     N/A ws N/A N/A pkg_resources WorkingSet N/A N/A N/A N/A N/A ws require requirements N/A skip False N/A N/A N/A N/A pkg_resources VersionConflict N/A N/A skip True N/A msg N/A N/A requires: {} format N/A N/A , join requirements N/A N/A N/A unittest skipIf skip msg N/A shaped_arange N/A N/A shape xp dtype N/A cupy N/A numpy float32 N/A N/A Returns an array with given shape, array module, and dtype.

    Args:
         shape(tuple of int): Shape of returned ndarray.
         xp(numpy or cupy): Array module to use.
         dtype(dtype): Dtype of returned ndarray.

    Returns:
         numpy.ndarray or cupy.ndarray:
         The array filled with :math:`1, \cdots, N` with specified dtype
         with given shape, array module. Here, :math:`N` is
         the size of the returned array.
         If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to
         ``True`` (resp. ``False``).

     N/A a N/A N/A numpy arange 1 N/A N/A N/A internal prod shape 1 1 N/A N/A N/A N/A N/A numpy dtype dtype type N/A numpy bool_ N/A N/A N/A N/A xp array N/A N/A N/A N/A a 2 0 reshape shape N/A N/A N/A N/A xp array N/A N/A N/A N/A a astype dtype reshape shape N/A shaped_reverse_arange N/A N/A shape xp dtype N/A cupy N/A numpy float32 N/A N/A Returns an array filled with decreasing numbers.

    Args:
         shape(tuple of int): Shape of returned ndarray.
         xp(numpy or cupy): Array module to use.
         dtype(dtype): Dtype of returned ndarray.

    Returns:
         numpy.ndarray or cupy.ndarray:
         The array filled with :math:`N, \cdots, 1` with specified dtype
         with given shape, array module.
         Here, :math:`N` is the size of the returned array.
         If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to
         ``True`` (resp. ``False``).
     N/A size N/A N/A internal prod shape N/A a N/A N/A numpy arange size 0 -1 N/A N/A N/A N/A N/A numpy dtype dtype type N/A numpy bool_ N/A N/A N/A N/A xp array N/A N/A N/A N/A a 2 0 reshape shape N/A N/A N/A N/A xp array N/A N/A N/A N/A a astype dtype reshape shape N/A shaped_random N/A N/A shape xp dtype scale seed N/A cupy N/A numpy float32 10 0 N/A N/A Returns an array filled with random values.

    Args:
         shape(tuple): Shape of returned ndarray.
         xp(numpy or cupy): Array module to use.
         dtype(dtype): Dtype of returned ndarray.
         scale(float): Scaling factor of elements.
         seed(int): Random seed.

    Returns:
         numpy.ndarray or cupy.ndarray: The array with
             given shape, array module,

    If ``dtype`` is ``numpy.bool_``, the elements are
    independetly drawn from ``True`` and ``False``
    with same probabilities.
    Otherwise, the array is filled with samples
    independently and identically drawn
    from uniform distribution over :math:`[0, scale)`
    with specified dtype.
     N/A N/A N/A N/A numpy random seed seed N/A N/A N/A N/A N/A numpy dtype dtype type N/A numpy bool_ N/A N/A N/A N/A xp asarray N/A N/A N/A N/A N/A numpy random randint 2 size shape astype dtype N/A N/A N/A N/A xp asarray N/A N/A N/A N/A N/A N/A numpy random rand shape scale astype dtype N/A NumpyError N/A object N/A __init__ N/A N/A self N/A kw N/A N/A N/A self kw kw N/A __enter__ N/A N/A self N/A N/A N/A N/A self err N/A N/A numpy geterr N/A N/A N/A numpy seterr N/A self kw N/A __exit__ N/A N/A self N/A _ N/A N/A N/A N/A numpy seterr N/A self err N/A N/A