/* Generated by Cython 3.2.5 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "_FORCE_INLINES",
                "1"
            ],
            [
                "CYTHON_EXTERN_C",
                "extern \"C\""
            ],
            [
                "NPY_TARGET_VERSION",
                "NPY_2_0_API_VERSION"
            ],
            [
                "CUPY_USE_HIP",
                "1"
            ],
            [
                "__HIP_PLATFORM_AMD__",
                "1"
            ],
            [
                "__HIP_PLATFORM_HCC__",
                "1"
            ],
            [
                "THRUST_DEVICE_SYSTEM",
                "THRUST_DEVICE_SYSTEM_HIP"
            ],
            [
                "CUPY_CACHE_KEY",
                "28a6d0d64fe089c15e4ff802c7b0f8edb50d2a99"
            ],
            [
                "CUPY_CUB_VERSION_CODE",
                400200
            ]
        ],
        "depends": [
            "/usr/lib/python3.14/site-packages/numpy/_core/include/numpy/arrayobject.h",
            "/usr/lib/python3.14/site-packages/numpy/_core/include/numpy/arrayscalars.h",
            "/usr/lib/python3.14/site-packages/numpy/_core/include/numpy/ndarrayobject.h",
            "/usr/lib/python3.14/site-packages/numpy/_core/include/numpy/ndarraytypes.h",
            "/usr/lib/python3.14/site-packages/numpy/_core/include/numpy/ufuncobject.h"
        ],
        "extra_compile_args": [
            "-std=c++14"
        ],
        "extra_link_args": [
            "-Wl,--disable-new-dtags,-rpath,/opt/rocm/hipfft/lib,-rpath,/opt/rocm/lib"
        ],
        "include_dirs": [
            "/opt/rocm/hipfft/include",
            "/opt/rocm/include/hipcub",
            "/build/python-cupy/src/python-cupy-rocm-gfx12/cupy/_core/include",
            "/opt/rocm/include",
            "/opt/rocm/include/hip",
            "/opt/rocm/include/rocrand",
            "/opt/rocm/include/hiprand",
            "/opt/rocm/include/roctracer",
            "/opt/rocm/include/hipblas",
            "/opt/rocm/include/hipsparse",
            "/opt/rocm/include/hipfft",
            "/opt/rocm/include/rocsolver",
            "/opt/rocm/include/rccl",
            "/usr/lib/python3.14/site-packages/numpy/_core/include"
        ],
        "language": "c++",
        "libraries": [
            "amdhip64",
            "hipblas",
            "hipfft",
            "hiprand",
            "hipsparse",
            "rocfft",
            "roctx64",
            "rocblas",
            "rocsolver",
            "rocsparse"
        ],
        "library_dirs": [
            "/opt/rocm/hipfft/lib",
            "/opt/rocm/lib"
        ],
        "name": "cupy._core._kernel",
        "sources": [
            "cupy/_core/_kernel.pyx"
        ]
    },
    "module_name": "cupy._core._kernel"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_5"
#define CYTHON_HEX_VERSION 0x030205F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#ifndef Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CppInitCode */
#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
    template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
    template<typename U> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
    template<typename U> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
  private:
    T *ptr;
};

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef METH_FASTCALL
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         ((int)PyUnicode_KIND(u))
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
    #define __PYX_EXTERN_C extern "C++"
#endif

#define __PYX_HAVE__cupy___core___kernel
#define __PYX_HAVE_API__cupy___core___kernel
/* Early includes */
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <vector>
#include <stdint.h>
#include <string.h>
#include <stdio.h>

    /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
    
#include "numpy/arrayobject.h"
#include "numpy/ndarrayobject.h"
#include "numpy/ndarraytypes.h"
#include "numpy/arrayscalars.h"
#include "numpy/ufuncobject.h"
#include <utility>

    #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
    // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include <map>

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE PyObject *
    __Pyx_CAPI_PyList_GetItemRef(PyObject *list, Py_ssize_t index)
    {
        PyObject *item = PyList_GetItem(list, index);
        Py_XINCREF(item);
        return item;
    }
    #else
    #define __Pyx_CAPI_PyList_GetItemRef PyList_GetItemRef
    #endif

    #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Extend(PyObject *list, PyObject *iterable)
    {
        return PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable);
    }

    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Clear(PyObject *list)
    {
        return PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL);
    }
    #else
    #define __Pyx_CAPI_PyList_Extend PyList_Extend
    #define __Pyx_CAPI_PyList_Clear PyList_Clear
    #endif
    

    #if PY_MAJOR_VERSION >= 3
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj)
    #else
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj, NULL)
    #endif
    
#include <stddef.h>

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result)
    {
        int res;
        PyObject *key_obj = PyUnicode_FromString(key);
        if (key_obj == NULL) {
            *result = NULL;
            return -1;
        }
        res = __Pyx_PyDict_GetItemRef(mp, key_obj, result);
        Py_DECREF(key_obj);
        return res;
    }
    #else
    #define __Pyx_CAPI_PyDict_GetItemStringRef PyDict_GetItemStringRef
    #endif
    #if PY_VERSION_HEX < 0x030d0000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030F0000)
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_SetDefaultRef(PyObject *d, PyObject *key, PyObject *default_value,
                        PyObject **result)
    {
        PyObject *value;
        if (__Pyx_PyDict_GetItemRef(d, key, &value) < 0) {
            // get error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (value != NULL) {
            // present
            if (result) {
                *result = value;
            }
            else {
                Py_DECREF(value);
            }
            return 1;
        }

        // missing: set the item
        if (PyDict_SetItem(d, key, default_value) < 0) {
            // set error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (result) {
            Py_INCREF(default_value);
            *result = default_value;
        }
        return 0;
    }
    #else
    #define __Pyx_CAPI_PyDict_SetDefaultRef PyDict_SetDefaultRef
    #endif
    

    #if PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int __Pyx_PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
    {
        PyObject *obj = PyWeakref_GetObject(ref);
        if (obj == NULL) {
            // SystemError if ref is NULL
            *pobj = NULL;
            return -1;
        }
        if (obj == Py_None) {
            *pobj = NULL;
            return 0;
        }
        Py_INCREF(obj);
        *pobj = obj;
        return 1;
    }
    #else
    #define __Pyx_PyWeakref_GetRef PyWeakref_GetRef
    #endif
    
#include "pythread.h"

    #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600) && !defined(PyContextVar_Get)
    #define PyContextVar_Get(var, d, v)         ((d) ?             ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) :             ((v)[0] = NULL, 0)         )
    #endif
    
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __pyx_cfilenm = __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "cupy/_core/_kernel.pyx",
  "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd",
  "cupy/cuda/memory.pxd",
  "cupy/_core/core.pxd",
  "cpython/contextvars.pxd",
  "cupy/_core/_dtype.pxd",
  "cupy/_core/_kernel.pxd",
  "(tree fragment)",
  "cupy/cuda/function.pxd",
  "cupy/_core/_carray.pxd",
  "cpython/type.pxd",
  "cpython/bool.pxd",
  "cpython/complex.pxd",
  "cupy/_core/_scalar.pxd",
  "cupy/cuda/device.pxd",
  "cupy/cuda/texture.pxd",
  "cupy_backends/cuda/api/runtime.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* #### Code section: numeric_typedefs ### */

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":744
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
*/
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":745
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
*/
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":746
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * 
*/
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":747
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_uint8      uint8_t
*/
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":749
 * ctypedef npy_int64      int64_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
*/
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":750
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
*/
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":751
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * 
*/
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":752
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_float32    float32_t
*/
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":754
 * ctypedef npy_uint64     uint64_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
*/
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":755
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
*/
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":762
 * ctypedef double complex complex128_t
 * 
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
*/
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":763
 * 
 * ctypedef npy_longlong   longlong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
*/
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":765
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
*/
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":766
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
*/
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":768
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
*/
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":769
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
*/
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":770
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef float complex       cfloat_t
*/
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* #### Code section: complex_type_declarations ### */
/* Declarations.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

/* Declarations.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    typedef ::std::complex< long double > __pyx_t_long_double_complex;
  #else
    typedef long double _Complex __pyx_t_long_double_complex;
  #endif
#else
    typedef struct { long double real, imag; } __pyx_t_long_double_complex;
#endif
static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double);

/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
struct __pyx_obj_4cupy_4cuda_8function_CPointer;
struct __pyx_obj_4cupy_4cuda_8function_Function;
struct __pyx_obj_4cupy_4cuda_8function_Module;
struct __pyx_obj_4cupy_4cuda_8function_LinkState;
struct __pyx_obj_4cupy_5_core_7_carray_mdspan;
struct __pyx_obj_4cupy_5_core_7_carray_CArray;
struct __pyx_obj_4cupy_5_core_7_carray_CIndexer;
struct __pyx_obj_4cupy_5_core_7_carray_Indexer;
struct __pyx_obj_4cupy_5_core_7_scalar_CScalar;
struct __pyx_obj_4cupy_4cuda_6device_Handle;
struct __pyx_obj_4cupy_4cuda_6device_Device;
struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory;
struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory;
struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer;
struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool;
struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory;
struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator;
struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory;
struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator;
struct __pyx_obj_4cupy_5_core_4core__ndarray_base;
struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor;
struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor;
struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor;
struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray;
struct __pyx_obj_4cupy_4cuda_7texture_TextureObject;
struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject;
struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes;
struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps;
struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo;
struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo;
struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap;
struct __pyx_obj_4cupy_5_core_7_kernel__Op;
struct __pyx_obj_4cupy_5_core_7_kernel__Ops;
struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel;
struct __pyx_obj_4cupy_5_core_7_kernel_ufunc;
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr;
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr;
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr;
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr;
struct __pyx_opt_args_4cupy_4cuda_8function_8Function_linear_launch;

/* "function.pxd":15
 *         public intptr_t ptr
 * 
 *     cpdef linear_launch(self, size_t size, args, size_t shared_mem=*,             # <<<<<<<<<<<<<<
 *                         size_t block_max_size=*, stream=*,
 *                         bint enable_cooperative_groups=*)
*/
struct __pyx_opt_args_4cupy_4cuda_8function_8Function_linear_launch {
  int __pyx_n;
  size_t shared_mem;
  size_t block_max_size;
  PyObject *stream;
  int enable_cooperative_groups;
};
struct __pyx_t_4cupy_5_core_7_carray__CArray;
struct __pyx_t_4cupy_5_core_7_carray__CIndexer;

/* "_carray.pxd":13
 * # this matches NPY_MAXDIMS
 * # Note: we make it an enum to work around cython/cython#4369
 * cdef enum: MAX_NDIM = 64             # <<<<<<<<<<<<<<
 * 
 * 
*/
enum  {
  __pyx_e_4cupy_5_core_7_carray_MAX_NDIM = 64
};

/* "_carray.pxd":8
 * 
 * 
 * ctypedef vector.vector[Py_ssize_t] shape_t             # <<<<<<<<<<<<<<
 * ctypedef vector.vector[Py_ssize_t] strides_t
 * 
*/
typedef std::vector<Py_ssize_t>  __pyx_t_4cupy_5_core_7_carray_shape_t;

/* "_carray.pxd":9
 * 
 * ctypedef vector.vector[Py_ssize_t] shape_t
 * ctypedef vector.vector[Py_ssize_t] strides_t             # <<<<<<<<<<<<<<
 * 
 * # this matches NPY_MAXDIMS
*/
typedef std::vector<Py_ssize_t>  __pyx_t_4cupy_5_core_7_carray_strides_t;

/* "_carray.pxd":17
 * 
 * # This is now excluding shape/strides only for getting the compiler-time size
 * cdef struct _CArray:             # <<<<<<<<<<<<<<
 *     void* data
 *     Py_ssize_t size
*/
struct __pyx_t_4cupy_5_core_7_carray__CArray {
  void *data;
  Py_ssize_t size;
};

/* "_carray.pxd":40
 * 
 * # This is now excluding shape/strides only for getting the compiler-time size
 * cdef struct _CIndexer:             # <<<<<<<<<<<<<<
 *     Py_ssize_t size
 * 
*/
struct __pyx_t_4cupy_5_core_7_carray__CIndexer {
  Py_ssize_t size;
};
struct __pyx_opt_args_7cpython_11contextvars_get_value;
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;

/* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value {
  int __pyx_n;
  PyObject *default_value;
};

/* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
  int __pyx_n;
  PyObject *default_value;
};
struct __pyx_opt_args_4cupy_5_core_7_scalar_get_typename;

/* "_scalar.pxd":40
 * cpdef str format_type_decls(set type_decls)
 * 
 * cpdef str get_typename(dtype, type_decls=*)             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t get_cuda_alignment(cnp.dtype dtype) except -1
 * 
*/
struct __pyx_opt_args_4cupy_5_core_7_scalar_get_typename {
  int __pyx_n;
  PyObject *type_decls;
};
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_device_async;
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_host_async;
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_async;
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_to_host_async;
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_memset_async;
struct __pyx_opt_args_4cupy_4cuda_6memory_set_allocator;
struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_free_all_blocks;
struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_set_limit;

/* "memory.pxd":39
 * 
 *     cpdef copy_from_device(self, MemoryPointer src, size_t size)
 *     cpdef copy_from_device_async(self, MemoryPointer src, size_t size,             # <<<<<<<<<<<<<<
 *                                  stream=?)
 *     cpdef copy_from_host(self, mem, size_t size)
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_device_async {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":42
 *                                  stream=?)
 *     cpdef copy_from_host(self, mem, size_t size)
 *     cpdef copy_from_host_async(self, mem, size_t size, stream=?)             # <<<<<<<<<<<<<<
 *     cpdef copy_from(self, mem, size_t size)
 *     cpdef copy_from_async(self, mem, size_t size, stream=?)
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_host_async {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":44
 *     cpdef copy_from_host_async(self, mem, size_t size, stream=?)
 *     cpdef copy_from(self, mem, size_t size)
 *     cpdef copy_from_async(self, mem, size_t size, stream=?)             # <<<<<<<<<<<<<<
 *     cpdef copy_to_host(self, mem, size_t size)
 *     cpdef copy_to_host_async(self, mem, size_t size, stream=?)
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_async {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":46
 *     cpdef copy_from_async(self, mem, size_t size, stream=?)
 *     cpdef copy_to_host(self, mem, size_t size)
 *     cpdef copy_to_host_async(self, mem, size_t size, stream=?)             # <<<<<<<<<<<<<<
 *     cpdef memset(self, int value, size_t size)
 *     cpdef memset_async(self, int value, size_t size, stream=?)
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_to_host_async {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":48
 *     cpdef copy_to_host_async(self, mem, size_t size, stream=?)
 *     cpdef memset(self, int value, size_t size)
 *     cpdef memset_async(self, int value, size_t size, stream=?)             # <<<<<<<<<<<<<<
 * 
 * 
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_memset_async {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":54
 * 
 * 
 * cpdef set_allocator(allocator=*)             # <<<<<<<<<<<<<<
 * cpdef get_allocator()
 * 
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_set_allocator {
  int __pyx_n;
  PyObject *allocator;
};

/* "memory.pxd":65
 * 
 *     cpdef MemoryPointer malloc(self, size_t size)
 *     cpdef free_all_blocks(self, stream=?)             # <<<<<<<<<<<<<<
 *     cpdef free_all_free(self)
 *     # they call device_pool so they may raise error.
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_free_all_blocks {
  int __pyx_n;
  PyObject *stream;
};

/* "memory.pxd":72
 *     cpdef size_t free_bytes(self)
 *     cpdef size_t total_bytes(self)
 *     cpdef set_limit(self, size=?, fraction=?)             # <<<<<<<<<<<<<<
 *     cpdef size_t get_limit(self)
 * 
*/
struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_set_limit {
  int __pyx_n;
  PyObject *size;
  PyObject *fraction;
};
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tobytes;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tofile;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base__astype;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_astype;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_byteswap;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_copy;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_view;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_flatten;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ravel;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_squeeze;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_take;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_put;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_repeat;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_choose;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sort;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argsort;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_partition;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argpartition;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_compress;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_diagonal;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_max;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmax;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_min;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmin;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ptp;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_clip;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_round;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_trace;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sum;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumsum;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_mean;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_var;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_std;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_prod;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumprod;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_all;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_any;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_get;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_set;
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_reduced_view;
struct __pyx_opt_args_4cupy_5_core_4core_ascontiguousarray;
struct __pyx_opt_args_4cupy_5_core_4core_asfortranarray;
struct __pyx_opt_args_4cupy_5_core_4core_compile_with_cache;
struct __pyx_opt_args_4cupy_5_core_4core_array;

/* "cupy/_core/core.pxd":31
 *     cpdef item(self)
 *     cpdef tolist(self)
 *     cpdef bytes tobytes(self, order=*)             # <<<<<<<<<<<<<<
 *     cpdef tofile(self, fid, sep=*, format=*)
 *     cpdef dump(self, file)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tobytes {
  int __pyx_n;
  PyObject *order;
};

/* "cupy/_core/core.pxd":32
 *     cpdef tolist(self)
 *     cpdef bytes tobytes(self, order=*)
 *     cpdef tofile(self, fid, sep=*, format=*)             # <<<<<<<<<<<<<<
 *     cpdef dump(self, file)
 *     cpdef bytes dumps(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tofile {
  int __pyx_n;
  PyObject *sep;
  PyObject *format;
};

/* "cupy/_core/core.pxd":35
 *     cpdef dump(self, file)
 *     cpdef bytes dumps(self)
 *     cpdef _ndarray_base _astype(             # <<<<<<<<<<<<<<
 *         self, dtype, order=*, casting=*, subok=*, copy=*)
 *     cpdef _ndarray_base astype(
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base__astype {
  int __pyx_n;
  PyObject *order;
  PyObject *casting;
  PyObject *subok;
  PyObject *copy;
};

/* "cupy/_core/core.pxd":37
 *     cpdef _ndarray_base _astype(
 *         self, dtype, order=*, casting=*, subok=*, copy=*)
 *     cpdef _ndarray_base astype(             # <<<<<<<<<<<<<<
 *         self, dtype, order=*, casting=*, subok=*, copy=*)
 *     cpdef _ndarray_base byteswap(self, inplace=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_astype {
  int __pyx_n;
  PyObject *order;
  PyObject *casting;
  PyObject *subok;
  PyObject *copy;
};

/* "cupy/_core/core.pxd":39
 *     cpdef _ndarray_base astype(
 *         self, dtype, order=*, casting=*, subok=*, copy=*)
 *     cpdef _ndarray_base byteswap(self, inplace=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base copy(self, order=*)
 *     cpdef _ndarray_base view(self, dtype=*, array_class=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_byteswap {
  int __pyx_n;
  PyObject *inplace;
};

/* "cupy/_core/core.pxd":40
 *         self, dtype, order=*, casting=*, subok=*, copy=*)
 *     cpdef _ndarray_base byteswap(self, inplace=*)
 *     cpdef _ndarray_base copy(self, order=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base view(self, dtype=*, array_class=*)
 *     cpdef fill(self, value)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_copy {
  int __pyx_n;
  PyObject *order;
};

/* "cupy/_core/core.pxd":41
 *     cpdef _ndarray_base byteswap(self, inplace=*)
 *     cpdef _ndarray_base copy(self, order=*)
 *     cpdef _ndarray_base view(self, dtype=*, array_class=*)             # <<<<<<<<<<<<<<
 *     cpdef fill(self, value)
 *     cpdef _ndarray_base swapaxes(self, Py_ssize_t axis1, Py_ssize_t axis2)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_view {
  int __pyx_n;
  PyObject *dtype;
  PyObject *array_class;
};

/* "cupy/_core/core.pxd":44
 *     cpdef fill(self, value)
 *     cpdef _ndarray_base swapaxes(self, Py_ssize_t axis1, Py_ssize_t axis2)
 *     cpdef _ndarray_base flatten(self, order=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base ravel(self, order=*)
 *     cpdef _ndarray_base squeeze(self, axis=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_flatten {
  int __pyx_n;
  PyObject *order;
};

/* "cupy/_core/core.pxd":45
 *     cpdef _ndarray_base swapaxes(self, Py_ssize_t axis1, Py_ssize_t axis2)
 *     cpdef _ndarray_base flatten(self, order=*)
 *     cpdef _ndarray_base ravel(self, order=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base squeeze(self, axis=*)
 *     cpdef _ndarray_base take(self, indices, axis=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ravel {
  int __pyx_n;
  PyObject *order;
};

/* "cupy/_core/core.pxd":46
 *     cpdef _ndarray_base flatten(self, order=*)
 *     cpdef _ndarray_base ravel(self, order=*)
 *     cpdef _ndarray_base squeeze(self, axis=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base take(self, indices, axis=*, out=*)
 *     cpdef put(self, indices, values, mode=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_squeeze {
  int __pyx_n;
  PyObject *axis;
};

/* "cupy/_core/core.pxd":47
 *     cpdef _ndarray_base ravel(self, order=*)
 *     cpdef _ndarray_base squeeze(self, axis=*)
 *     cpdef _ndarray_base take(self, indices, axis=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef put(self, indices, values, mode=*)
 *     cpdef repeat(self, repeats, axis=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_take {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
};

/* "cupy/_core/core.pxd":48
 *     cpdef _ndarray_base squeeze(self, axis=*)
 *     cpdef _ndarray_base take(self, indices, axis=*, out=*)
 *     cpdef put(self, indices, values, mode=*)             # <<<<<<<<<<<<<<
 *     cpdef repeat(self, repeats, axis=*)
 *     cpdef choose(self, choices, out=*, mode=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_put {
  int __pyx_n;
  PyObject *mode;
};

/* "cupy/_core/core.pxd":49
 *     cpdef _ndarray_base take(self, indices, axis=*, out=*)
 *     cpdef put(self, indices, values, mode=*)
 *     cpdef repeat(self, repeats, axis=*)             # <<<<<<<<<<<<<<
 *     cpdef choose(self, choices, out=*, mode=*)
 *     cpdef sort(self, int axis=*, kind=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_repeat {
  int __pyx_n;
  PyObject *axis;
};

/* "cupy/_core/core.pxd":50
 *     cpdef put(self, indices, values, mode=*)
 *     cpdef repeat(self, repeats, axis=*)
 *     cpdef choose(self, choices, out=*, mode=*)             # <<<<<<<<<<<<<<
 *     cpdef sort(self, int axis=*, kind=*)
 *     cpdef _ndarray_base argsort(self, axis=*, kind=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_choose {
  int __pyx_n;
  PyObject *out;
  PyObject *mode;
};

/* "cupy/_core/core.pxd":51
 *     cpdef repeat(self, repeats, axis=*)
 *     cpdef choose(self, choices, out=*, mode=*)
 *     cpdef sort(self, int axis=*, kind=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base argsort(self, axis=*, kind=*)
 *     cpdef partition(self, kth, int axis=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sort {
  int __pyx_n;
  int axis;
  PyObject *kind;
};

/* "cupy/_core/core.pxd":52
 *     cpdef choose(self, choices, out=*, mode=*)
 *     cpdef sort(self, int axis=*, kind=*)
 *     cpdef _ndarray_base argsort(self, axis=*, kind=*)             # <<<<<<<<<<<<<<
 *     cpdef partition(self, kth, int axis=*)
 *     cpdef _ndarray_base argpartition(self, kth, axis=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argsort {
  int __pyx_n;
  PyObject *axis;
  PyObject *kind;
};

/* "cupy/_core/core.pxd":53
 *     cpdef sort(self, int axis=*, kind=*)
 *     cpdef _ndarray_base argsort(self, axis=*, kind=*)
 *     cpdef partition(self, kth, int axis=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base argpartition(self, kth, axis=*)
 *     cpdef tuple nonzero(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_partition {
  int __pyx_n;
  int axis;
};

/* "cupy/_core/core.pxd":54
 *     cpdef _ndarray_base argsort(self, axis=*, kind=*)
 *     cpdef partition(self, kth, int axis=*)
 *     cpdef _ndarray_base argpartition(self, kth, axis=*)             # <<<<<<<<<<<<<<
 *     cpdef tuple nonzero(self)
 *     cpdef _ndarray_base compress(self, condition, axis=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argpartition {
  int __pyx_n;
  PyObject *axis;
};

/* "cupy/_core/core.pxd":56
 *     cpdef _ndarray_base argpartition(self, kth, axis=*)
 *     cpdef tuple nonzero(self)
 *     cpdef _ndarray_base compress(self, condition, axis=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base diagonal(self, offset=*, axis1=*, axis2=*)
 *     cpdef _ndarray_base max(self, axis=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_compress {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
};

/* "cupy/_core/core.pxd":57
 *     cpdef tuple nonzero(self)
 *     cpdef _ndarray_base compress(self, condition, axis=*, out=*)
 *     cpdef _ndarray_base diagonal(self, offset=*, axis1=*, axis2=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base max(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmax(self, axis=*, out=*, dtype=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_diagonal {
  int __pyx_n;
  PyObject *offset;
  PyObject *axis1;
  PyObject *axis2;
};

/* "cupy/_core/core.pxd":58
 *     cpdef _ndarray_base compress(self, condition, axis=*, out=*)
 *     cpdef _ndarray_base diagonal(self, offset=*, axis1=*, axis2=*)
 *     cpdef _ndarray_base max(self, axis=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base argmax(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base min(self, axis=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_max {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":59
 *     cpdef _ndarray_base diagonal(self, offset=*, axis1=*, axis2=*)
 *     cpdef _ndarray_base max(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmax(self, axis=*, out=*, dtype=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base min(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmin(self, axis=*, out=*, dtype=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmax {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *dtype;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":60
 *     cpdef _ndarray_base max(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmax(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base min(self, axis=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base argmin(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base ptp(self, axis=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_min {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":61
 *     cpdef _ndarray_base argmax(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base min(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmin(self, axis=*, out=*, dtype=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base ptp(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base clip(self, min=*, max=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmin {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *dtype;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":62
 *     cpdef _ndarray_base min(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base argmin(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base ptp(self, axis=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base clip(self, min=*, max=*, out=*)
 *     cpdef _ndarray_base round(self, decimals=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ptp {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":63
 *     cpdef _ndarray_base argmin(self, axis=*, out=*, dtype=*, keepdims=*)
 *     cpdef _ndarray_base ptp(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base clip(self, min=*, max=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base round(self, decimals=*, out=*)
 * 
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_clip {
  int __pyx_n;
  PyObject *min;
  PyObject *max;
  PyObject *out;
};

/* "cupy/_core/core.pxd":64
 *     cpdef _ndarray_base ptp(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base clip(self, min=*, max=*, out=*)
 *     cpdef _ndarray_base round(self, decimals=*, out=*)             # <<<<<<<<<<<<<<
 * 
 *     cpdef _ndarray_base trace(self, offset=*, axis1=*, axis2=*, dtype=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_round {
  int __pyx_n;
  PyObject *decimals;
  PyObject *out;
};

/* "cupy/_core/core.pxd":66
 *     cpdef _ndarray_base round(self, decimals=*, out=*)
 * 
 *     cpdef _ndarray_base trace(self, offset=*, axis1=*, axis2=*, dtype=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base sum(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base cumsum(self, axis=*, dtype=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_trace {
  int __pyx_n;
  PyObject *offset;
  PyObject *axis1;
  PyObject *axis2;
  PyObject *dtype;
  PyObject *out;
};

/* "cupy/_core/core.pxd":67
 * 
 *     cpdef _ndarray_base trace(self, offset=*, axis1=*, axis2=*, dtype=*, out=*)
 *     cpdef _ndarray_base sum(self, axis=*, dtype=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base cumsum(self, axis=*, dtype=*, out=*)
 *     cpdef _ndarray_base mean(self, axis=*, dtype=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sum {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":68
 *     cpdef _ndarray_base trace(self, offset=*, axis1=*, axis2=*, dtype=*, out=*)
 *     cpdef _ndarray_base sum(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base cumsum(self, axis=*, dtype=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base mean(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base var(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumsum {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
};

/* "cupy/_core/core.pxd":69
 *     cpdef _ndarray_base sum(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base cumsum(self, axis=*, dtype=*, out=*)
 *     cpdef _ndarray_base mean(self, axis=*, dtype=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base var(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base std(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_mean {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":70
 *     cpdef _ndarray_base cumsum(self, axis=*, dtype=*, out=*)
 *     cpdef _ndarray_base mean(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base var(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base std(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base prod(self, axis=*, dtype=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_var {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
  PyObject *ddof;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":71
 *     cpdef _ndarray_base mean(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base var(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base std(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base prod(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base cumprod(self, axis=*, dtype=*, out=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_std {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
  PyObject *ddof;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":72
 *     cpdef _ndarray_base var(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base std(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base prod(self, axis=*, dtype=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base cumprod(self, axis=*, dtype=*, out=*)
 *     cpdef _ndarray_base _add_reduceat(self, indices, axis, dtype, out)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_prod {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":73
 *     cpdef _ndarray_base std(self, axis=*, dtype=*, out=*, ddof=*, keepdims=*)
 *     cpdef _ndarray_base prod(self, axis=*, dtype=*, out=*, keepdims=*)
 *     cpdef _ndarray_base cumprod(self, axis=*, dtype=*, out=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base _add_reduceat(self, indices, axis, dtype, out)
 *     cpdef _ndarray_base all(self, axis=*, out=*, keepdims=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumprod {
  int __pyx_n;
  PyObject *axis;
  PyObject *dtype;
  PyObject *out;
};

/* "cupy/_core/core.pxd":75
 *     cpdef _ndarray_base cumprod(self, axis=*, dtype=*, out=*)
 *     cpdef _ndarray_base _add_reduceat(self, indices, axis, dtype, out)
 *     cpdef _ndarray_base all(self, axis=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base any(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base conj(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_all {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":76
 *     cpdef _ndarray_base _add_reduceat(self, indices, axis, dtype, out)
 *     cpdef _ndarray_base all(self, axis=*, out=*, keepdims=*)
 *     cpdef _ndarray_base any(self, axis=*, out=*, keepdims=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base conj(self)
 *     cpdef _ndarray_base conjugate(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_any {
  int __pyx_n;
  PyObject *axis;
  PyObject *out;
  PyObject *keepdims;
};

/* "cupy/_core/core.pxd":79
 *     cpdef _ndarray_base conj(self)
 *     cpdef _ndarray_base conjugate(self)
 *     cpdef get(self, stream=*, order=*, out=*, blocking=*)             # <<<<<<<<<<<<<<
 *     cpdef set(self, arr, stream=*)
 *     cpdef _ndarray_base reduced_view(self, dtype=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_get {
  int __pyx_n;
  PyObject *stream;
  PyObject *order;
  PyObject *out;
  PyObject *blocking;
};

/* "cupy/_core/core.pxd":80
 *     cpdef _ndarray_base conjugate(self)
 *     cpdef get(self, stream=*, order=*, out=*, blocking=*)
 *     cpdef set(self, arr, stream=*)             # <<<<<<<<<<<<<<
 *     cpdef _ndarray_base reduced_view(self, dtype=*)
 *     cdef _update_c_contiguity(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_set {
  int __pyx_n;
  PyObject *stream;
};

/* "cupy/_core/core.pxd":81
 *     cpdef get(self, stream=*, order=*, out=*, blocking=*)
 *     cpdef set(self, arr, stream=*)
 *     cpdef _ndarray_base reduced_view(self, dtype=*)             # <<<<<<<<<<<<<<
 *     cdef _update_c_contiguity(self)
 *     cdef _update_f_contiguity(self)
*/
struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_reduced_view {
  int __pyx_n;
  PyObject *dtype;
};

/* "cupy/_core/core.pxd":101
 * cpdef _ndarray_base _internal_ascontiguousarray(_ndarray_base a)
 * cpdef _ndarray_base _internal_asfortranarray(_ndarray_base a)
 * cpdef _ndarray_base ascontiguousarray(_ndarray_base a, dtype=*)             # <<<<<<<<<<<<<<
 * cpdef _ndarray_base asfortranarray(_ndarray_base a, dtype=*)
 * 
*/
struct __pyx_opt_args_4cupy_5_core_4core_ascontiguousarray {
  int __pyx_n;
  PyObject *dtype;
};

/* "cupy/_core/core.pxd":102
 * cpdef _ndarray_base _internal_asfortranarray(_ndarray_base a)
 * cpdef _ndarray_base ascontiguousarray(_ndarray_base a, dtype=*)
 * cpdef _ndarray_base asfortranarray(_ndarray_base a, dtype=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef Module compile_with_cache(str source, tuple options=*, arch=*,
*/
struct __pyx_opt_args_4cupy_5_core_4core_asfortranarray {
  int __pyx_n;
  PyObject *dtype;
};

/* "cupy/_core/core.pxd":104
 * cpdef _ndarray_base asfortranarray(_ndarray_base a, dtype=*)
 * 
 * cpdef Module compile_with_cache(str source, tuple options=*, arch=*,             # <<<<<<<<<<<<<<
 *                                 prepend_cupy_headers=*,
 *                                 backend=*, translate_cucomplex=*,
*/
struct __pyx_opt_args_4cupy_5_core_4core_compile_with_cache {
  int __pyx_n;
  PyObject *options;
  PyObject *arch;
  PyObject *prepend_cupy_headers;
  PyObject *backend;
  PyObject *translate_cucomplex;
  PyObject *enable_cooperative_groups;
  PyObject *name_expressions;
  PyObject *log_stream;
  int jitify;
};

/* "cupy/_core/core.pxd":114
 * # TODO(niboshi): Move to _routines_creation.pyx
 * 
 * cpdef _ndarray_base array(             # <<<<<<<<<<<<<<
 *     obj, dtype=*, copy=*, order=*, bint subok=*, Py_ssize_t ndmin=*,
 *     bint blocking=*)
*/
struct __pyx_opt_args_4cupy_5_core_4core_array {
  int __pyx_n;
  PyObject *dtype;
  PyObject *copy;
  PyObject *order;
  int subok;
  Py_ssize_t ndmin;
  int blocking;
};

/* "_accelerator.pxd":7
 * cdef list _routine_accelerators
 * 
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     ACCELERATOR_CUB = 1
 *     ACCELERATOR_CUTENSOR = 2
*/
enum  {
  __pyx_e_4cupy_5_core_12_accelerator_ACCELERATOR_CUB = 1,
  __pyx_e_4cupy_5_core_12_accelerator_ACCELERATOR_CUTENSOR = 2,
  __pyx_e_4cupy_5_core_12_accelerator_ACCELERATOR_CUTENSORNET = 3
};
struct __pyx_opt_args_4cupy_5_core_6_dtype_to_cuda_dtype;
struct __pyx_opt_args_4cupy_5_core_6_dtype__raise_if_invalid_cast;

/* "cupy/_core/_dtype.pxd":11
 * cpdef get_dtype(t)
 * cpdef tuple get_dtype_with_itemsize(t, bint check_support)
 * cpdef int to_cuda_dtype(dtype, bint is_half_allowed=*) except -1             # <<<<<<<<<<<<<<
 * 
 * cpdef void _raise_if_invalid_cast(
*/
struct __pyx_opt_args_4cupy_5_core_6_dtype_to_cuda_dtype {
  int __pyx_n;
  int is_half_allowed;
};

/* "cupy/_core/_dtype.pxd":13
 * cpdef int to_cuda_dtype(dtype, bint is_half_allowed=*) except -1
 * 
 * cpdef void _raise_if_invalid_cast(             # <<<<<<<<<<<<<<
 *     from_dt,
 *     to_dt,
*/
struct __pyx_opt_args_4cupy_5_core_6_dtype__raise_if_invalid_cast {
  int __pyx_n;
  PyObject *argname;
};
struct __pyx_opt_args_4cupy_5_core_8internal__normalize_order;
struct __pyx_opt_args_4cupy_5_core_8internal__normalize_axis_indices;
struct __pyx_opt_args_4cupy_5_core_8internal__get_strides_for_order_K;

/* "internal.pxd":45
 * cpdef size_t clp2(size_t x) noexcept
 * 
 * cdef int _normalize_order(order, cpp_bool allow_k=*) except? 0             # <<<<<<<<<<<<<<
 * 
 * cdef _broadcast_core(list arrays, shape_t& shape)
*/
struct __pyx_opt_args_4cupy_5_core_8internal__normalize_order {
  int __pyx_n;
  bool allow_k;
};

/* "internal.pxd":54
 *     Py_ssize_t axis, Py_ssize_t ndim) except -1
 * 
 * cpdef tuple _normalize_axis_indices(             # <<<<<<<<<<<<<<
 *     axes, Py_ssize_t ndim, cpp_bool sort_axes=*)
 * 
*/
struct __pyx_opt_args_4cupy_5_core_8internal__normalize_axis_indices {
  int __pyx_n;
  bool sort_axes;
};

/* "internal.pxd":57
 *     axes, Py_ssize_t ndim, cpp_bool sort_axes=*)
 * 
 * cpdef strides_t _get_strides_for_order_K(x, dtype, shape=*) except *             # <<<<<<<<<<<<<<
 * 
 * cpdef int _update_order_char(
*/
struct __pyx_opt_args_4cupy_5_core_8internal__get_strides_for_order_K {
  int __pyx_n;
  PyObject *shape;
};

/* "cupy_backends/cuda/api/_driver_enum.pxd":1
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     # CUjitInputType
 *     CU_JIT_INPUT_CUBIN = 0
*/
enum  {
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_CUBIN = 0,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_PTX = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_FATBINARY = 2,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_OBJECT = 3,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_LIBRARY = 4,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INPUT_NVVM = 5,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_MAX_REGISTERS = 0,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_THREADS_PER_BLOCK = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_WALL_TIME = 2,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INFO_LOG_BUFFER = 3,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_ERROR_LOG_BUFFER = 5,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_OPTIMIZATION_LEVEL = 7,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_TARGET_FROM_CUCONTEXT = 8,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_TARGET = 9,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_FALLBACK_STRATEGY = 10,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_GENERATE_DEBUG_INFO = 11,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_LOG_VERBOSE = 12,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_GENERATE_LINE_INFO = 13,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_CACHE_MODE = 14,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_NEW_SM3X_OPT = 15,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_FAST_COMPILE = 16,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_GLOBAL_SYMBOL_NAMES = 17,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_GLOBAL_SYMBOL_COUNT = 19,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_LTO = 20,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_FTZ = 21,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_PREC_DIV = 22,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_PREC_SQRT = 23,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_FMA = 24,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_JIT_NUM_OPTIONS = 25,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CUDA_ERROR_INVALID_VALUE = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_SIGNED_INT8 = 0x08,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_SIGNED_INT16 = 0x09,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_HALF = 0x10,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_AD_FORMAT_FLOAT = 0x20,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_ADDRESS_MODE_WRAP = 0,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_ADDRESS_MODE_CLAMP = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_ADDRESS_MODE_MIRROR = 2,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_ADDRESS_MODE_BORDER = 3,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_FILTER_MODE_POINT = 0,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TR_FILTER_MODE_LINEAR = 1,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TRSA_OVERRIDE_FORMAT = 0x01,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TRSF_READ_AS_INTEGER = 0x01,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TRSF_NORMALIZED_COORDINATES = 0x02,
  __pyx_e_13cupy_backends_4cuda_3api_12_driver_enum_CU_TRSF_SRGB = 0x10
};

/* "cupy_backends/cuda/api/_runtime_enum.pxd":1
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     # need to revisit this when cython supports C++ enums (in 3.0)
 *     # https://stackoverflow.com/a/67138945
*/
enum  {

  /* "cupy_backends/cuda/api/_runtime_enum.pxd":116
 *     cudaGraphDebugDotFlagsKernelNodeAttributes = 1<<9
 *     cudaGraphDebugDotFlagsHandles = 1<<10
 *     cudaGraphDebugDotFlagsConditionalNodeParams = 1<<15             # <<<<<<<<<<<<<<
 * 
 * # This was a legacy mistake: the prefix "cuda" should have been removed
*/
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemoryTypeHost = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemoryTypeDevice = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaIpcMemLazyEnablePeerAccess = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAttachGlobal = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAttachHost = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAttachSingle = 4,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaCpuDeviceId = -1L,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaInvalidDeviceId = -2L,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseSetReadMostly = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseUnsetReadMostly = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseSetPreferredLocation = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseUnsetPreferredLocation = 4,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseSetAccessedBy = 5,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAdviseUnsetAccessedBy = 6,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_32F = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_64F = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_16F = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_8I = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_C_32F = 4,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_C_64F = 5,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_C_16F = 6,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_C_8I = 7,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_8U = 8,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_C_8U = 9,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_CUDA_R_16BF = 14,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitStackSize = 0x00,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitPrintfFifoSize = 0x01,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitMallocHeapSize = 0x02,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitDevRuntimeSyncDepth = 0x03,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitDevRuntimePendingLaunchCount = 0x04,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaLimitMaxL2FetchGranularity = 0x05,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaChannelFormatKindSigned = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaChannelFormatKindUnsigned = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaChannelFormatKindFloat = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaChannelFormatKindNone = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaArrayDefault = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaArraySurfaceLoadStore = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaResourceTypeArray = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaResourceTypeMipmappedArray = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaResourceTypeLinear = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaResourceTypePitch2D = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaAddressModeWrap = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaAddressModeClamp = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaAddressModeMirror = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaAddressModeBorder = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaFilterModePoint = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaFilterModeLinear = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaReadModeElementType = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaReadModeNormalizedFloat = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolReuseFollowEventDependencies = 0x1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolReuseAllowOpportunistic = 0x2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolReuseAllowInternalDependencies = 0x3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolAttrReleaseThreshold = 0x4,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolAttrReservedMemCurrent = 0x5,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolAttrReservedMemHigh = 0x6,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolAttrUsedMemCurrent = 0x7,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemPoolAttrUsedMemHigh = 0x8,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemAllocationTypePinned = 0x1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemHandleTypeNone = 0x0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemHandleTypePosixFileDescriptor = 0x1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemLocationTypeInvalid = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemLocationTypeDevice = 1,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemLocationTypeHost = 2,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemLocationTypeHostNuma = 3,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaMemLocationTypeHostNumaCurrent = 4,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsVerbose = (1 << 0),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsKernelNodeParams = (1 << 2),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsMemcpyNodeParams = (1 << 3),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsMemsetNodeParams = (1 << 4),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsHostNodeParams = (1 << 5),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsEventNodeParams = (1 << 6),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsExtSemasSignalNodeParams = (1 << 7),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsExtSemasWaitNodeParams = (1 << 8),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsKernelNodeAttributes = (1 << 9),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsHandles = (1 << 10),
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaGraphDebugDotFlagsConditionalNodeParams = (1 << 15)
};

/* "cupy_backends/cuda/api/_runtime_enum.pxd":124
 * IF CUPY_HIP_VERSION > 0:
 *     # separate in groups of 10 for easier counting...
 *     cpdef enum:             # <<<<<<<<<<<<<<
 *         cudaDevAttrMaxThreadsPerBlock = 0
 *         cudaDevAttrMaxBlockDimX
*/
enum  {
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxThreadsPerBlock = 0,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxBlockDimX,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxBlockDimY,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxBlockDimZ,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxGridDimX,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxGridDimY,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxGridDimZ,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxSharedMemoryPerBlock,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrTotalConstantMemory,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrWarpSize,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxRegistersPerBlock,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrClockRate,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMemoryClockRate,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrGlobalMemoryBusWidth,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMultiProcessorCount,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrComputeMode,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrL2CacheSize,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxThreadsPerMultiProcessor,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrConcurrentKernels = 20,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrPciBusId,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrPciDeviceId,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxSharedMemoryPerMultiprocessor,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrIsMultiGpuBoard,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrIntegrated,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrCooperativeLaunch,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrCooperativeMultiDeviceLaunch,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture1DWidth,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture2DWidth,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture2DHeight,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture3DWidth,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture3DHeight,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxTexture3DDepth,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMaxPitch = 36,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrTextureAlignment,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrTexturePitchAlignment,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrKernelExecTimeout,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrCanMapHostMemory,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrEccEnabled,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrMemoryPoolsSupported = 0
};

/* "cupy_backends/cuda/api/_runtime_enum.pxd":240
 *         # cudaDevAttrHostRegisterSupported
 *     IF CUPY_HIP_VERSION >= 310:
 *         cpdef enum:             # <<<<<<<<<<<<<<
 *             # hipDeviceAttributeAsicRevision  # does not exist in CUDA
 *             cudaDevAttrManagedMemory = 47
*/
enum  {
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrManagedMemory = 47,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrDirectManagedMemAccessFromHost,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrConcurrentManagedAccess,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrPageableMemoryAccess,
  __pyx_e_13cupy_backends_4cuda_3api_13_runtime_enum_cudaDevAttrPageableMemoryAccessUsesHostPageTables
};
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_mallocManaged;
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_malloc3DArray;
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_mallocArray;
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamAddCallback;
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamWaitEvent;
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamBeginCapture;

/* "runtime.pxd":99
 * 
 * # For backward compatibility, keep APIs not prefixed with "cuda".
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     memcpyHostToHost = 0
 *     memcpyHostToDevice = 1
*/
enum  {
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memcpyHostToHost = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memcpyHostToDevice = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memcpyDeviceToHost = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memcpyDeviceToDevice = 3,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memcpyDefault = 4,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_hostAllocDefault = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_hostAllocPortable = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_hostAllocMapped = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_hostAllocWriteCombined = 4,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamDefault = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamNonBlocking = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamLegacy = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamPerThread = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_eventDefault = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_eventBlockingSync = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_eventDisableTiming = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_eventInterprocess = 4,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureModeGlobal = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureModeThreadLocal = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureModeRelaxed = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureStatusNone = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureStatusActive = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_streamCaptureStatusInvalidated = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memoryTypeUnregistered = 0,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memoryTypeHost = 1,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memoryTypeDevice = 2,
  __pyx_e_13cupy_backends_4cuda_3api_7runtime_memoryTypeManaged = 3
};

/* "runtime.pxd":205
 * 
 * cpdef intptr_t malloc(size_t size) except? 0
 * cpdef intptr_t mallocManaged(size_t size, unsigned int flags=*) except? 0             # <<<<<<<<<<<<<<
 * cpdef intptr_t malloc3DArray(intptr_t desc, size_t width, size_t height,
 *                              size_t depth, unsigned int flags=*) except? 0
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_mallocManaged {
  int __pyx_n;
  unsigned int flags;
};

/* "runtime.pxd":206
 * cpdef intptr_t malloc(size_t size) except? 0
 * cpdef intptr_t mallocManaged(size_t size, unsigned int flags=*) except? 0
 * cpdef intptr_t malloc3DArray(intptr_t desc, size_t width, size_t height,             # <<<<<<<<<<<<<<
 *                              size_t depth, unsigned int flags=*) except? 0
 * cpdef intptr_t mallocArray(intptr_t desc, size_t width, size_t height,
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_malloc3DArray {
  int __pyx_n;
  unsigned int flags;
};

/* "runtime.pxd":208
 * cpdef intptr_t malloc3DArray(intptr_t desc, size_t width, size_t height,
 *                              size_t depth, unsigned int flags=*) except? 0
 * cpdef intptr_t mallocArray(intptr_t desc, size_t width, size_t height,             # <<<<<<<<<<<<<<
 *                            unsigned int flags=*) except? 0
 * cpdef intptr_t mallocAsync(size_t size, intptr_t stream) except? 0
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_mallocArray {
  int __pyx_n;
  unsigned int flags;
};

/* "runtime.pxd":275
 * cpdef streamDestroy(intptr_t stream)
 * cpdef streamSynchronize(intptr_t stream)
 * cpdef streamAddCallback(intptr_t stream, callback, intptr_t arg,             # <<<<<<<<<<<<<<
 *                         unsigned int flags=*)
 * cpdef launchHostFunc(intptr_t stream, callback, intptr_t arg)
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamAddCallback {
  int __pyx_n;
  unsigned int flags;
};

/* "runtime.pxd":280
 * cpdef _launchHostFuncUnmanaged(intptr_t stream, tuple func_arg)
 * cpdef streamQuery(intptr_t stream)
 * cpdef streamWaitEvent(intptr_t stream, intptr_t event, unsigned int flags=*)             # <<<<<<<<<<<<<<
 * cpdef streamBeginCapture(intptr_t stream, int mode=*)
 * cpdef intptr_t streamEndCapture(intptr_t stream) except? 0
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamWaitEvent {
  int __pyx_n;
  unsigned int flags;
};

/* "runtime.pxd":281
 * cpdef streamQuery(intptr_t stream)
 * cpdef streamWaitEvent(intptr_t stream, intptr_t event, unsigned int flags=*)
 * cpdef streamBeginCapture(intptr_t stream, int mode=*)             # <<<<<<<<<<<<<<
 * cpdef intptr_t streamEndCapture(intptr_t stream) except? 0
 * cpdef bint streamIsCapturing(intptr_t stream) except*
*/
struct __pyx_opt_args_13cupy_backends_4cuda_3api_7runtime_streamBeginCapture {
  int __pyx_n;
  int mode;
};
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type;
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type;
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code;
struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples;
struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types;
struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc;
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params;
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code;
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code;
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel;

/* "cupy/_core/_kernel.pxd":20
 * 
 * 
 * cdef enum _ArgKind:             # <<<<<<<<<<<<<<
 *     ARG_KIND_NDARRAY = 1
 *     ARG_KIND_INDEXER
*/
enum __pyx_t_4cupy_5_core_7_kernel__ArgKind {
  __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY = 1,
  __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_INDEXER,
  __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_SCALAR,
  __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_POINTER,
  __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_TEXTURE
};

/* "cupy/_core/_kernel.pxd":73
 *     cdef bint is_scalar(self) noexcept
 * 
 *     cdef str get_c_type(self, type_decls=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_param_c_type(self, ParameterInfo p, type_decls=*)
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type {
  int __pyx_n;
  PyObject *type_decls;
};

/* "cupy/_core/_kernel.pxd":75
 *     cdef str get_c_type(self, type_decls=*)
 * 
 *     cdef str get_param_c_type(self, ParameterInfo p, type_decls=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p)
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type {
  int __pyx_n;
  PyObject *type_decls;
};

/* "cupy/_core/_kernel.pxd":87
 *         tuple _pairs
 * 
 *     cdef str get_typedef_code(self, type_decls=*)             # <<<<<<<<<<<<<<
 * 
 * 
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code {
  int __pyx_n;
  PyObject *type_decls;
};

/* "cupy/_core/_kernel.pxd":138
 * 
 *     @staticmethod
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=*)             # <<<<<<<<<<<<<<
 * 
 *     # Queries a single op from input arguments.
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples {
  int __pyx_n;
  PyObject *promote_types;
};

/* "cupy/_core/_kernel.pxd":145
 *         _Ops out_ops)
 * 
 *     cpdef _Op _guess_routine_from_in_types(             # <<<<<<<<<<<<<<
 *         self, tuple in_types, tuple weaks=*, object can_cast=*)
 * 
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types {
  int __pyx_n;
  PyObject *weaks;
  PyObject *can_cast;
};

/* "cupy/_core/_kernel.pxd":151
 * 
 * 
 * cpdef create_ufunc(name, ops, routine=*, preamble=*, doc=*,             # <<<<<<<<<<<<<<
 *                    default_casting=*, loop_prep=*, out_ops=*,
 *                    cutensor_op=*, scatter_op=*, promote_types=*)
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc {
  int __pyx_n;
  PyObject *routine;
  PyObject *preamble;
  PyObject *doc;
  PyObject *default_casting;
  PyObject *loop_prep;
  PyObject *out_ops;
  PyObject *cutensor_op;
  PyObject *scatter_op;
  PyObject *promote_types;
};

/* "cupy/_core/_kernel.pxd":159
 * cdef tuple _get_arginfos(list args)
 * 
 * cdef str _get_kernel_params(tuple params, tuple arginfos, type_decls=*)             # <<<<<<<<<<<<<<
 * 
 * cdef list _broadcast(list args, tuple params, bint use_size, shape_t& shape)
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params {
  int __pyx_n;
  PyObject *type_decls;
};

/* "cupy/_core/_kernel.pyx":78
 * 
 * 
 * cdef str _get_simple_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         tuple params_, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop=''):
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code {
  int __pyx_n;
  PyObject *loop_prep;
  PyObject *after_loop;
};

/* "cupy/_core/_kernel.pyx":110
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel_from_code(             # <<<<<<<<<<<<<<
 *         str name, str code, tuple options=()):
 *     module = compile_with_cache(code, options)
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code {
  int __pyx_n;
  PyObject *options;
};

/* "cupy/_core/_kernel.pyx":116
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel(             # <<<<<<<<<<<<<<
 *         tuple params, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop='',
*/
struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel {
  int __pyx_n;
  PyObject *loop_prep;
  PyObject *after_loop;
  PyObject *options;
};

/* "function.pxd":4
 * 
 * 
 * cdef class CPointer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/
struct __pyx_obj_4cupy_4cuda_8function_CPointer {
  PyObject_HEAD
  intptr_t ptr;
};


/* "function.pxd":9
 * 
 * 
 * cdef class Function:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_8function_Function {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_8function_Function *__pyx_vtab;
  struct __pyx_obj_4cupy_4cuda_8function_Module *module;
  intptr_t ptr;
};


/* "function.pxd":20
 * 
 * 
 * cdef class Module:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_8function_Module {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_8function_Module *__pyx_vtab;
  intptr_t ptr;
  PyObject *mapping;
};


/* "function.pxd":34
 * 
 * 
 * cdef class LinkState:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_8function_LinkState {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_8function_LinkState *__pyx_vtab;
  intptr_t ptr;
};


/* "_carray.pxd":22
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class mdspan(function.CPointer):
 * 
*/
struct __pyx_obj_4cupy_5_core_7_carray_mdspan {
  struct __pyx_obj_4cupy_4cuda_8function_CPointer __pyx_base;
  struct __pyx_vtabstruct_4cupy_5_core_7_carray_mdspan *__pyx_vtab;
};


/* "_carray.pxd":31
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class CArray(function.CPointer):
 * 
*/
struct __pyx_obj_4cupy_5_core_7_carray_CArray {
  struct __pyx_obj_4cupy_4cuda_8function_CPointer __pyx_base;
  struct __pyx_vtabstruct_4cupy_5_core_7_carray_CArray *__pyx_vtab;
};


/* "_carray.pxd":44
 * 
 * 
 * cdef class CIndexer(function.CPointer):             # <<<<<<<<<<<<<<
 * 
 *     cdef void init(self, Py_ssize_t size, const shape_t &shape) except*
*/
struct __pyx_obj_4cupy_5_core_7_carray_CIndexer {
  struct __pyx_obj_4cupy_4cuda_8function_CPointer __pyx_base;
  struct __pyx_vtabstruct_4cupy_5_core_7_carray_CIndexer *__pyx_vtab;
};


/* "_carray.pxd":49
 * 
 * 
 * cdef class Indexer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly Py_ssize_t size
*/
struct __pyx_obj_4cupy_5_core_7_carray_Indexer {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_carray_Indexer *__pyx_vtab;
  Py_ssize_t size;
  __pyx_t_4cupy_5_core_7_carray_shape_t shape;
  int _index_32_bits;
};


/* "_scalar.pxd":20
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class CScalar(CPointer):
 * 
*/
struct __pyx_obj_4cupy_5_core_7_scalar_CScalar {
  struct __pyx_obj_4cupy_4cuda_8function_CPointer __pyx_base;
  struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar *__pyx_vtab;
  __pyx_t_long_double_complex _data[2];
  PyObject *value;
  PyArray_Descr *descr;
  PyObject *weak_t;
};


/* "device.pxd":13
 * cdef bint _enable_peer_access(int device, int peer) except -1
 * 
 * cdef class Handle:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public size_t handle
*/
struct __pyx_obj_4cupy_4cuda_6device_Handle {
  PyObject_HEAD
  size_t handle;
  PyObject *_destroy_func;
};


/* "device.pxd":18
 *         object _destroy_func
 * 
 * cdef class Device:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public int id
*/
struct __pyx_obj_4cupy_4cuda_6device_Device {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_6device_Device *__pyx_vtab;
  int id;
  PyObject *_device_stack;
};


/* "memory.pxd":10
 * 
 * 
 * @cython.no_gc             # <<<<<<<<<<<<<<
 * cdef class BaseMemory:
 * 
*/
struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory {
  PyObject_HEAD
  intptr_t ptr;
  size_t size;
  int device_id;
};


/* "memory.pxd":19
 * 
 * 
 * @cython.no_gc             # <<<<<<<<<<<<<<
 * cdef class SystemMemory(BaseMemory):
 * 
*/
struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory {
  struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory __pyx_base;
  struct __pyx_vtabstruct_4cupy_4cuda_6memory_SystemMemory *__pyx_vtab;
  PyObject *_owner;
};


/* "memory.pxd":29
 * 
 * 
 * cdef class MemoryPointer:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPointer *__pyx_vtab;
  intptr_t ptr;
  int device_id;
  struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory *mem;
};


/* "memory.pxd":58
 * 
 * 
 * cdef class MemoryPool:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPool *__pyx_vtab;
  PyObject *_pools;
  PyObject *_allocator;
};


/* "memory.pxd":89
 * 
 * 
 * @cython.no_gc             # <<<<<<<<<<<<<<
 * cdef class CFunctionAllocatorMemory(BaseMemory):
 * 
*/
struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory {
  struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory __pyx_base;
  intptr_t _param;
  intptr_t _free_func;
};


/* "memory.pxd":97
 * 
 * 
 * cdef class CFunctionAllocator:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_6memory_CFunctionAllocator *__pyx_vtab;
  intptr_t _param;
  intptr_t _malloc_func;
  intptr_t _free_func;
  PyObject *_owner;
};


/* "memory.pxd":108
 * 
 * 
 * cdef class PythonFunctionAllocatorMemory(BaseMemory):             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory {
  struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory __pyx_base;
  PyObject *_free_func;
};


/* "memory.pxd":114
 * 
 * 
 * cdef class PythonFunctionAllocator:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/
struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_6memory_PythonFunctionAllocator *__pyx_vtab;
  PyObject *_malloc_func;
  PyObject *_free_func;
};


/* "cupy/_core/core.pxd":10
 * 
 * 
 * cdef class _ndarray_base:             # <<<<<<<<<<<<<<
 *     cdef:
 *         object __weakref__
*/
struct __pyx_obj_4cupy_5_core_4core__ndarray_base {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *__pyx_vtab;
  PyObject *__weakref__;
  Py_ssize_t size;
  __pyx_t_4cupy_5_core_7_carray_shape_t _shape;
  __pyx_t_4cupy_5_core_7_carray_strides_t _strides;
  int _c_contiguous;
  int _f_contiguous;
  int _index_32_bits;
  PyObject *dtype;
  struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *data;
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *base;
};


/* "texture.pxd":6
 * 
 * 
 * cdef class ChannelFormatDescriptor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor {
  PyObject_HEAD
  intptr_t ptr;
};


/* "texture.pxd":11
 * 
 * 
 * cdef class ResourceDescriptor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor {
  PyObject_HEAD
  intptr_t ptr;
  struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor *chDesc;
  struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray *cuArr;
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *arr;
};


/* "texture.pxd":19
 * 
 * 
 * cdef class TextureDescriptor:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor {
  PyObject_HEAD
  intptr_t ptr;
};


/* "texture.pxd":24
 * 
 * 
 * cdef class CUDAarray:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_4cuda_7texture_CUDAarray *__pyx_vtab;
  intptr_t ptr;
  struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor *desc;
  size_t width;
  size_t height;
  size_t depth;
  unsigned int flags;
  int ndim;
};


/* "texture.pxd":37
 * 
 * 
 * cdef class TextureObject:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly uintmax_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_TextureObject {
  PyObject_HEAD
  uintmax_t ptr;
  struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor *ResDesc;
  struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor *TexDesc;
};


/* "texture.pxd":44
 * 
 * 
 * cdef class SurfaceObject:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly uintmax_t ptr
*/
struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject {
  PyObject_HEAD
  uintmax_t ptr;
  struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor *ResDesc;
};


/* "runtime.pxd":8
 * ###############################################################################
 * 
 * cdef class PointerAttributes:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly int device
*/
struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes {
  PyObject_HEAD
  int device;
  intptr_t devicePointer;
  intptr_t hostPointer;
  int type;
};


/* "runtime.pxd":15
 *         readonly int type
 * 
 * cdef class MemPoolProps:             # <<<<<<<<<<<<<<
 *     # flatten the struct & list meaningful members
 *     cdef:
*/
struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps {
  PyObject_HEAD
  int allocType;
  int handleType;
  int locationType;
  int devId;
};


/* "cupy/_core/_kernel.pxd":11
 * 
 * 
 * cdef class ParameterInfo:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly str name
*/
struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo {
  PyObject_HEAD
  PyObject *name;
  PyObject *dtype;
  PyObject *ctype;
  int raw;
  int is_const;
};


/* "cupy/_core/_kernel.pxd":28
 * 
 * 
 * cdef class _ArgInfo:             # <<<<<<<<<<<<<<
 *     # Holds metadata of an argument.
 *     # This class is immutable and used as a part of hash keys.
*/
struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *__pyx_vtab;
  enum __pyx_t_4cupy_5_core_7_kernel__ArgKind arg_kind;
  PyTypeObject *type;
  PyObject *dtype;
  int ndim;
  int c_contiguous;
  int index_32_bits;
};


/* "cupy/_core/_kernel.pxd":80
 * 
 * 
 * cdef class _TypeMap:             # <<<<<<<<<<<<<<
 *     # Typedef mapping between C types.
 *     # This class is immutable.
*/
struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel__TypeMap *__pyx_vtab;
  PyObject *_pairs;
};


/* "cupy/_core/_kernel.pxd":90
 * 
 * 
 * cdef class _Op:             # <<<<<<<<<<<<<<
 *     """Simple data structure that represents a kernel routine with single \
 * concrete dtype mapping.
*/
struct __pyx_obj_4cupy_5_core_7_kernel__Op {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op *__pyx_vtab;
  PyObject *in_types;
  PyObject *out_types;
  int nin;
  int nout;
  PyObject *routine;
  PyObject *error_func;
  PyObject *_resolution_func;
  PyObject *_in_dtypes;
  PyObject *_out_dtypes;
};


/* "cupy/_core/_kernel.pxd":127
 * 
 * 
 * cdef class _Ops:             # <<<<<<<<<<<<<<
 *     """A kernel routine representation with various dtype mappings.
 *     """
*/
struct __pyx_obj_4cupy_5_core_7_kernel__Ops {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops *__pyx_vtab;
  PyObject *ops;
  int nin;
  int nout;
  PyObject *promote_types;
};


/* "cupy/_core/_kernel.pyx":743
 * 
 * 
 * cdef class ElementwiseKernel:             # <<<<<<<<<<<<<<
 * 
 *     """User-defined elementwise kernel.
*/
struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_vtab;
  PyObject *in_params;
  PyObject *out_params;
  Py_ssize_t nin;
  Py_ssize_t nout;
  Py_ssize_t nargs;
  PyObject *params;
  PyObject *operation;
  PyObject *name;
  PyObject *__pyx___name__;
  int reduce_dims;
  PyObject *preamble;
  int no_return;
  int return_tuple;
  PyObject *kwargs;
  PyObject *_params_type_memo;
  PyObject *_elementwise_kernel_memo;
  PyObject *_cached_codes;
};


/* "cupy/_core/_kernel.pyx":1147
 * 
 * 
 * cdef class ufunc:             # <<<<<<<<<<<<<<
 * 
 *     """Universal function.
*/
struct __pyx_obj_4cupy_5_core_7_kernel_ufunc {
  PyObject_HEAD
  struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc *__pyx_vtab;
  Py_ssize_t nin;
  Py_ssize_t nout;
  Py_ssize_t nargs;
  PyObject *name;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *_ops;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *_out_ops;
  PyObject *_preamble;
  PyObject *_loop_prep;
  PyObject *_default_casting;
  PyObject *_cutensor_op;
  int _cutensor_alpha;
  int _cutensor_gamma;
  PyObject *_scatter_op;
  PyObject *_params;
  PyObject *_params_with_where;
  PyObject *_routine_cache;
  PyObject *_kernel_memo;
  PyObject *_doc;
  PyObject *__pyx___doc__;
  PyObject *__pyx___name__;
};


/* "cupy/_core/_kernel.pyx":1209
 * 
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)             # <<<<<<<<<<<<<<
 *             for i in range(nin))
 *         _out_params = tuple(
*/
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_i;
  PyObject *__pyx_t_0;
  PyObject *(*__pyx_t_1)(PyObject *);
};


/* "cupy/_core/_kernel.pyx":1212
 *             for i in range(nin))
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)             # <<<<<<<<<<<<<<
 *             for i in range(nout))
 *         _other_params = (
*/
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_i;
  PyObject *__pyx_t_0;
  PyObject *(*__pyx_t_1)(PyObject *);
};


/* "cupy/_core/_kernel.pyx":1503
 *         in_args = 'x'
 *     else:
 *         in_args = ', '.join(f'x{i+1}' for i in range(ufunc.nin))             # <<<<<<<<<<<<<<
 * 
 *     # output arguments are both keyword or positional
*/
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_i;
};


/* "cupy/_core/_kernel.pyx":1513
 *         out_args = '[, {positional}], / [, out={default}]'.format(
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),             # <<<<<<<<<<<<<<
 *             default=repr((None,)*ufunc.nout)
 *         )
*/
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_i;
};



/* "function.pxd":9
 * 
 * 
 * cdef class Function:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_8function_Function {
  PyObject *(*linear_launch)(struct __pyx_obj_4cupy_4cuda_8function_Function *, size_t, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_8function_8Function_linear_launch *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4cupy_4cuda_8function_Function *__pyx_vtabptr_4cupy_4cuda_8function_Function;


/* "function.pxd":20
 * 
 * 
 * cdef class Module:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_8function_Module {
  PyObject *(*load_file)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*load)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*get_global_var)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*get_function)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_set_mapping)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_enumerate_and_build_mapping)(struct __pyx_obj_4cupy_4cuda_8function_Module *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_4cuda_8function_Module *__pyx_vtabptr_4cupy_4cuda_8function_Module;


/* "function.pxd":34
 * 
 * 
 * cdef class LinkState:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_8function_LinkState {
  PyObject *(*add_ptr_data)(struct __pyx_obj_4cupy_4cuda_8function_LinkState *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*add_ptr_file)(struct __pyx_obj_4cupy_4cuda_8function_LinkState *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*complete)(struct __pyx_obj_4cupy_4cuda_8function_LinkState *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_4cuda_8function_LinkState *__pyx_vtabptr_4cupy_4cuda_8function_LinkState;


/* "_carray.pxd":22
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class mdspan(function.CPointer):
 * 
*/

struct __pyx_vtabstruct_4cupy_5_core_7_carray_mdspan {
  int (*init)(struct __pyx_obj_4cupy_5_core_7_carray_mdspan *, void *, int, __pyx_t_4cupy_5_core_7_carray_shape_t const &, __pyx_t_4cupy_5_core_7_carray_strides_t const &, int, int);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_carray_mdspan *__pyx_vtabptr_4cupy_5_core_7_carray_mdspan;


/* "_carray.pxd":31
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class CArray(function.CPointer):
 * 
*/

struct __pyx_vtabstruct_4cupy_5_core_7_carray_CArray {
  void (*init)(struct __pyx_obj_4cupy_5_core_7_carray_CArray *, void *, Py_ssize_t, __pyx_t_4cupy_5_core_7_carray_shape_t const &, __pyx_t_4cupy_5_core_7_carray_strides_t const &);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_carray_CArray *__pyx_vtabptr_4cupy_5_core_7_carray_CArray;


/* "_carray.pxd":44
 * 
 * 
 * cdef class CIndexer(function.CPointer):             # <<<<<<<<<<<<<<
 * 
 *     cdef void init(self, Py_ssize_t size, const shape_t &shape) except*
*/

struct __pyx_vtabstruct_4cupy_5_core_7_carray_CIndexer {
  void (*init)(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer *, Py_ssize_t, __pyx_t_4cupy_5_core_7_carray_shape_t const &);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_carray_CIndexer *__pyx_vtabptr_4cupy_5_core_7_carray_CIndexer;


/* "_carray.pxd":49
 * 
 * 
 * cdef class Indexer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly Py_ssize_t size
*/

struct __pyx_vtabstruct_4cupy_5_core_7_carray_Indexer {
  void (*init)(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *, __pyx_t_4cupy_5_core_7_carray_shape_t const &);
  struct __pyx_obj_4cupy_4cuda_8function_CPointer *(*get_pointer)(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_carray_Indexer *__pyx_vtabptr_4cupy_5_core_7_carray_Indexer;


/* "_scalar.pxd":20
 * 
 * 
 * @cython.final             # <<<<<<<<<<<<<<
 * cdef class CScalar(CPointer):
 * 
*/

struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar {
  struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *(*from_int32)(int32_t);
  void (*_free_ptr)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *);
  PyObject *(*_store_c_value)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *);
  PyObject *(*apply_dtype)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*get_numpy_type)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar *__pyx_vtabptr_4cupy_5_core_7_scalar_CScalar;


/* "device.pxd":18
 *         object _destroy_func
 * 
 * cdef class Device:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public int id
*/

struct __pyx_vtabstruct_4cupy_4cuda_6device_Device {
  PyObject *(*use)(struct __pyx_obj_4cupy_4cuda_6device_Device *, int __pyx_skip_dispatch);
  PyObject *(*synchronize)(struct __pyx_obj_4cupy_4cuda_6device_Device *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6device_Device *__pyx_vtabptr_4cupy_4cuda_6device_Device;


/* "memory.pxd":19
 * 
 * 
 * @cython.no_gc             # <<<<<<<<<<<<<<
 * cdef class SystemMemory(BaseMemory):
 * 
*/

struct __pyx_vtabstruct_4cupy_4cuda_6memory_SystemMemory {
  PyObject *(*from_external)(intptr_t, size_t, PyObject *);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6memory_SystemMemory *__pyx_vtabptr_4cupy_4cuda_6memory_SystemMemory;


/* "memory.pxd":29
 * 
 * 
 * cdef class MemoryPointer:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPointer {
  PyObject *(*_init)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory *, ptrdiff_t);
  PyObject *(*copy_from_device)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, size_t, int __pyx_skip_dispatch);
  PyObject *(*copy_from_device_async)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_device_async *__pyx_optional_args);
  PyObject *(*copy_from_host)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch);
  PyObject *(*copy_from_host_async)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_host_async *__pyx_optional_args);
  PyObject *(*copy_from)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch);
  PyObject *(*copy_from_async)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_from_async *__pyx_optional_args);
  PyObject *(*copy_to_host)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch);
  PyObject *(*copy_to_host_async)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, PyObject *, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_copy_to_host_async *__pyx_optional_args);
  PyObject *(*memset)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, int, size_t, int __pyx_skip_dispatch);
  PyObject *(*memset_async)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *, int, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_13MemoryPointer_memset_async *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPointer *__pyx_vtabptr_4cupy_4cuda_6memory_MemoryPointer;


/* "memory.pxd":58
 * 
 * 
 * cdef class MemoryPool:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPool {
  struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *(*malloc)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, size_t, int __pyx_skip_dispatch);
  PyObject *(*free_all_blocks)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_free_all_blocks *__pyx_optional_args);
  PyObject *(*free_all_free)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  size_t (*n_free_blocks)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  size_t (*used_bytes)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  size_t (*free_bytes)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  size_t (*total_bytes)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  PyObject *(*set_limit)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_4cuda_6memory_10MemoryPool_set_limit *__pyx_optional_args);
  size_t (*get_limit)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *, int __pyx_skip_dispatch);
  PyObject *(*_ensure_pools_and_return_device_pool)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *);
  PyObject *(*device_pool)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPool *__pyx_vtabptr_4cupy_4cuda_6memory_MemoryPool;
static CYTHON_INLINE PyObject *__pyx_f_4cupy_4cuda_6memory_10MemoryPool_device_pool(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *);


/* "memory.pxd":97
 * 
 * 
 * cdef class CFunctionAllocator:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_6memory_CFunctionAllocator {
  struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *(*malloc)(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator *, size_t, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6memory_CFunctionAllocator *__pyx_vtabptr_4cupy_4cuda_6memory_CFunctionAllocator;


/* "memory.pxd":114
 * 
 * 
 * cdef class PythonFunctionAllocator:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
*/

struct __pyx_vtabstruct_4cupy_4cuda_6memory_PythonFunctionAllocator {
  struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *(*malloc)(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator *, size_t, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_4cuda_6memory_PythonFunctionAllocator *__pyx_vtabptr_4cupy_4cuda_6memory_PythonFunctionAllocator;


/* "cupy/_core/core.pxd":10
 * 
 * 
 * cdef class _ndarray_base:             # <<<<<<<<<<<<<<
 *     cdef:
 *         object __weakref__
*/

struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base {
  PyObject *(*_init_fast)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, int);
  int (*is_host_accessible)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  PyObject *(*item)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  PyObject *(*tolist)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  PyObject *(*tobytes)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tobytes *__pyx_optional_args);
  PyObject *(*tofile)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_tofile *__pyx_optional_args);
  PyObject *(*dump)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*dumps)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*_astype)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base__astype *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*astype)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_astype *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*byteswap)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_byteswap *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*copy)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_copy *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*view)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_view *__pyx_optional_args);
  PyObject *(*fill)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*swapaxes)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*flatten)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_flatten *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*ravel)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ravel *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*squeeze)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_squeeze *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*take)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_take *__pyx_optional_args);
  PyObject *(*put)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_put *__pyx_optional_args);
  PyObject *(*repeat)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_repeat *__pyx_optional_args);
  PyObject *(*choose)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_choose *__pyx_optional_args);
  PyObject *(*sort)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sort *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*argsort)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argsort *__pyx_optional_args);
  PyObject *(*partition)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_partition *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*argpartition)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argpartition *__pyx_optional_args);
  PyObject *(*nonzero)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*compress)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_compress *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*diagonal)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_diagonal *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*max)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_max *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*argmax)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmax *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*min)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_min *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*argmin)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_argmin *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*ptp)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_ptp *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*clip)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_clip *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*round)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_round *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*trace)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_trace *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*sum)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_sum *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*cumsum)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumsum *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*mean)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_mean *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*var)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_var *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*std)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_std *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*prod)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_prod *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*cumprod)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_cumprod *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*_add_reduceat)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*all)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_all *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*any)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_any *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*conj)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*conjugate)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
  PyObject *(*get)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_get *__pyx_optional_args);
  PyObject *(*set)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_set *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*reduced_view)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_13_ndarray_base_reduced_view *__pyx_optional_args);
  PyObject *(*_update_c_contiguity)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  PyObject *(*_update_f_contiguity)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  PyObject *(*_update_contiguity)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  PyObject *(*_set_shape_and_strides)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, __pyx_t_4cupy_5_core_7_carray_strides_t const &, int, int, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*_view)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, __pyx_t_4cupy_5_core_7_carray_strides_t const &, int, int, PyObject *);
  PyObject *(*_set_contiguous_strides)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, Py_ssize_t, int);
  struct __pyx_obj_4cupy_4cuda_8function_CPointer *(*get_pointer)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  PyObject *(*toDlpack)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *__pyx_vtabptr_4cupy_5_core_4core__ndarray_base;


/* "texture.pxd":24
 * 
 * 
 * cdef class CUDAarray:             # <<<<<<<<<<<<<<
 *     cdef:
 *         readonly intptr_t ptr
*/

struct __pyx_vtabstruct_4cupy_4cuda_7texture_CUDAarray {
  int (*_get_memory_kind)(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray *, PyObject *, PyObject *);
  void *(*_make_cudaMemcpy3DParms)(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray *, PyObject *, PyObject *);
  void (*_prepare_copy)(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray *, PyObject *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_4cupy_4cuda_7texture_CUDAarray *__pyx_vtabptr_4cupy_4cuda_7texture_CUDAarray;


/* "cupy/_core/_kernel.pyx":189
 * 
 * 
 * cdef class _ArgInfo:             # <<<<<<<<<<<<<<
 *     # Holds metadata of an argument.
 *     # This class is immutable and used as a part of hash keys.
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*_init)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, PyTypeObject *, PyObject *, int, int, int);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_arg)(PyObject *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_ndarray)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_scalar)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_indexer)(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_memptr)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*from_texture)(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject *);
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*as_ndarray_with_ndim)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, int);
  int (*is_ndarray)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *);
  int (*is_scalar)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *);
  PyObject *(*get_c_type)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type *__pyx_optional_args);
  PyObject *(*get_param_c_type)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type *__pyx_optional_args);
  PyObject *(*get_c_var_name)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *__pyx_vtabptr_4cupy_5_core_7_kernel__ArgInfo;


/* "cupy/_core/_kernel.pyx":534
 * 
 * 
 * cdef class _TypeMap:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, pairs):
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel__TypeMap {
  PyObject *(*get_typedef_code)(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code *__pyx_optional_args);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__TypeMap *__pyx_vtabptr_4cupy_5_core_7_kernel__TypeMap;


/* "cupy/_core/_kernel.pyx":1532
 * 
 * 
 * cdef class _Op:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*_from_type_and_routine_or_error_func)(PyObject *, PyObject *, PyObject *, PyObject *);
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*from_type_and_routine)(PyObject *, PyObject *, PyObject *);
  PyObject *(*resolve_dtypes)(struct __pyx_obj_4cupy_5_core_7_kernel__Op *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*from_type_and_error_func)(PyObject *, PyObject *);
  PyObject *(*check_valid)(struct __pyx_obj_4cupy_5_core_7_kernel__Op *);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op *__pyx_vtabptr_4cupy_5_core_7_kernel__Op;


/* "cupy/_core/_kernel.pyx":1611
 *                 f"routine={self.routine}, error_func={self.error_func})")
 * 
 * cdef class _Ops:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, tuple ops, promote_types=None):
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops {
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *(*from_tuples)(PyObject *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*guess_routine)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*_guess_routine_from_in_types)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types *__pyx_optional_args);
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*_guess_routine_from_dtype)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops *__pyx_vtabptr_4cupy_5_core_7_kernel__Ops;


/* "cupy/_core/_kernel.pyx":743
 * 
 * 
 * cdef class ElementwiseKernel:             # <<<<<<<<<<<<<<
 * 
 *     """User-defined elementwise kernel.
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel {
  PyObject *(*_decide_params_type)(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_4cupy_4cuda_8function_Function *(*_get_elementwise_kernel)(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *, int, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_vtabptr_4cupy_5_core_7_kernel_ElementwiseKernel;


/* "cupy/_core/_kernel.pyx":1147
 * 
 * 
 * cdef class ufunc:             # <<<<<<<<<<<<<<
 * 
 *     """Universal function.
*/

struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc {
  PyObject *(*_get_name_with_type)(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *, PyObject *, int);
  struct __pyx_obj_4cupy_4cuda_8function_Function *(*_get_ufunc_kernel)(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *, PyObject *, PyObject *, int, struct __pyx_obj_4cupy_5_core_7_kernel__Op *, PyObject *, int);
};
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc *__pyx_vtabptr_4cupy_5_core_7_kernel_ufunc;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  #define __Pyx_XINCREF(r)  do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyImportError_Check.proto */
#define __Pyx_PyExc_ImportError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ImportError)

/* PyObjectCall.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectFastCall.proto */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

/* RaiseException.export */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* HasAttr.proto */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyTypeError_Check.proto */
#define __Pyx_PyExc_TypeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_TypeError)

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* IncludeStringH.proto (used by JoinPyUnicode) */
#include <string.h>

/* JoinPyUnicode.export */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* BytesEquals.proto (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* DictGetItem.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyNumber_Hex.proto */
#define __Pyx_PyNumber_Hex(obj) PyNumber_ToBase((obj), 16)

/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywordsImpl.export */
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name
);
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* ArgTypeTestFunc.export */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* RejectKeywords.export */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_bint(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_bint(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_bint(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_bint(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_bint(int value, Py_ssize_t width, char padding_char, char format_char);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

/* PyObjectCallMethod1.proto (used by append) */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck, int unsafe_shared);

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw);

/* py_dict_pop.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value);

/* CallUnboundCMethod1.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* MoveIfSupported.proto */
#if CYTHON_USE_CPP_STD_MOVE
  #include <utility>
  #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
#else
  #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
#endif

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* dict_setdefault.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* IterNextPlain.proto (used by IterNext) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2
    return PyList_Extend(L, v);
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* RaiseUnboundLocalError.proto */
static void __Pyx_RaiseUnboundLocalError(const char *varname);

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* PyRange_Check.proto */
#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  #define PyRange_Check(obj)  __Pyx_TypeCheck((obj), &PyRange_Type)
#endif

/* ImportImpl.export */
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared)
    #endif
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_OwnStrongReference)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_SharedReference)
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right))

/* PyNotImplementedError_Check.proto */
#define __Pyx_PyExc_NotImplementedError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_NotImplementedError)

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyCallable_Check(obj)   (Py_TYPE(obj)->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

/* PyRuntimeError_Check.proto */
#define __Pyx_PyExc_RuntimeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_RuntimeError)

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
#if !CYTHON_USE_TYPE_SLOTS
#define  __Pyx_PySequence_Multiply PySequence_Repeat
#else
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
#endif

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* CallTypeTraverse.proto */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* FunctionExport.proto */
static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig);

/* GetApiDict.proto */
static PyObject *__Pyx_ApiExport_GetApiDict(void);

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

/* PyObjectCallMethod0.proto (used by PyType_Ready) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* DelItemOnTypeDict.proto (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_5
#define __PYX_HAVE_RT_ImportType_proto_3_2_5
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_5(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_5(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_5 {
   __Pyx_ImportType_CheckSize_Error_3_2_5 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_5 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_5 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_5(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_5 check_size);
#endif

/* VoidPtrImport.proto */
static int __Pyx_ImportVoidPtr_3_2_5(PyObject *module, const char *name, void **p, const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction_3_2_5(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CheckUnpickleChecksum.proto */
static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members);

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #define __Pyx_c_eq_long__double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_long__double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_long__double(a, b) ((a)-(b))
    #define __Pyx_c_prod_long__double(a, b) ((a)*(b))
    #define __Pyx_c_quot_long__double(a, b) ((a)/(b))
    #define __Pyx_c_neg_long__double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0)
    #define __Pyx_c_conj_long__double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_long__double(z)     (::std::abs(z))
        #define __Pyx_c_pow_long__double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_long__double(z) ((z)==0)
    #define __Pyx_c_conj_long__double(z)    (conjl(z))
    #if 1
        #define __Pyx_c_abs_long__double(z)     (cabsl(z))
        #define __Pyx_c_pow_long__double(a, b)  (cpowl(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex);
    #if 1
        static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex);
        static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind value);

/* CIntFromPy.proto */
static CYTHON_INLINE enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __Pyx_PyLong_As_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(int value);

/* UpdateUnpickledDict.proto */
static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index);

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* AddModuleRef.proto */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CoroutineBase) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* SwapException.proto (used by CoroutineBase) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

/* Generator.proto */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_4cuda_6memory_10MemoryPool_device_pool(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *__pyx_v_self); /* proto*/
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
#endif
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo__init(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __pyx_v_arg_kind, PyTypeObject *__pyx_v_typ, PyObject *__pyx_v_dtype, int __pyx_v_ndim, int __pyx_v_c_contiguous, int __pyx_v_index_32_bits); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_arg(PyObject *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_ndarray(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_scalar(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_indexer(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_memptr(CYTHON_UNUSED struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_texture(CYTHON_UNUSED struct __pyx_obj_4cupy_4cuda_7texture_TextureObject *__pyx_v_arg); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_as_ndarray_with_ndim(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, int __pyx_v_ndim); /* proto*/
static int __pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_ndarray(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto*/
static int __pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_scalar(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_var_name(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__decide_params_type(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__get_elementwise_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, int __pyx_v_dev_id, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_name_with_type(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_arginfos, int __pyx_v_has_where); /* proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_ufunc_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_in_dtypes, PyObject *__pyx_v_out_dtypes, int __pyx_v_dev_id, struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_op, PyObject *__pyx_v_arginfos, int __pyx_v_has_where); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op__from_type_and_routine_or_error_func(PyObject *__pyx_v_typ, PyObject *__pyx_v_routine, PyObject *__pyx_v_error_func, PyObject *__pyx_v_resolution_func); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_routine(PyObject *__pyx_v_typ, PyObject *__pyx_v_routine, PyObject *__pyx_v_resolution_func); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_error_func(PyObject *__pyx_v_typ, PyObject *__pyx_v_error_func); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_3_Op_check_valid(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_3_Op_resolve_dtypes(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_args, PyObject *__pyx_v_out_args, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_f_4cupy_5_core_7_kernel_4_Ops_from_tuples(PyObject *__pyx_v_ops, PyObject *__pyx_v_routine, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples *__pyx_optional_args); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops_guess_routine(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_in_args, PyObject *__pyx_v_dtype, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_in_types, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types *__pyx_optional_args); /* proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_dtype(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_dtype, int __pyx_skip_dispatch); /* proto*/

/* Module declarations from "libcpp" */

/* Module declarations from "libcpp.vector" */

/* Module declarations from "cupy._core" */

/* Module declarations from "cython" */

/* Module declarations from "libc.stdint" */

/* Module declarations from "cupy.cuda" */

/* Module declarations from "cupy.cuda.function" */

/* Module declarations from "cupy._core._carray" */
static struct __pyx_obj_4cupy_5_core_7_carray_Indexer *(*__pyx_f_4cupy_5_core_7_carray__indexer_init)(__pyx_t_4cupy_5_core_7_carray_shape_t const &); /*proto*/

/* Module declarations from "libc.string" */

/* Module declarations from "libc.stdio" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "cpython.version" */

/* Module declarations from "cpython.exc" */

/* Module declarations from "cpython.module" */

/* Module declarations from "cpython.mem" */

/* Module declarations from "cpython.tuple" */

/* Module declarations from "cpython.list" */

/* Module declarations from "cpython.sequence" */

/* Module declarations from "cpython.mapping" */

/* Module declarations from "cpython.iterator" */

/* Module declarations from "cpython.number" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.bool" */

/* Module declarations from "cpython.long" */

/* Module declarations from "cpython.float" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.complex" */

/* Module declarations from "libc.stddef" */

/* Module declarations from "cpython.unicode" */

/* Module declarations from "cpython.pyport" */

/* Module declarations from "cpython.dict" */

/* Module declarations from "cpython.instance" */

/* Module declarations from "cpython.function" */

/* Module declarations from "cpython.method" */

/* Module declarations from "cpython.weakref" */

/* Module declarations from "cpython.getargs" */

/* Module declarations from "cpython.pythread" */

/* Module declarations from "cpython.pystate" */

/* Module declarations from "cpython.set" */

/* Module declarations from "cpython.buffer" */

/* Module declarations from "cpython.bytes" */

/* Module declarations from "cpython.pycapsule" */

/* Module declarations from "cpython.contextvars" */

/* Module declarations from "cpython" */

/* Module declarations from "cpython.object" */

/* Module declarations from "cpython.ref" */

/* Module declarations from "numpy" */

/* Module declarations from "numpy" */

/* Module declarations from "cupy._core._scalar" */
static PyObject **__pyx_vp_4cupy_5_core_7_scalar_scalar_type_set = 0;
#define __pyx_v_4cupy_5_core_7_scalar_scalar_type_set (*__pyx_vp_4cupy_5_core_7_scalar_scalar_type_set)
static PyObject *(*__pyx_f_4cupy_5_core_7_scalar_format_type_decls)(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_4cupy_5_core_7_scalar_get_typename)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_scalar_get_typename *__pyx_optional_args); /*proto*/

/* Module declarations from "libcpp.utility" */

/* Module declarations from "libcpp.map" */

/* Module declarations from "cupy.cuda.device" */
static int (*__pyx_f_4cupy_4cuda_6device_get_device_id)(int __pyx_skip_dispatch); /*proto*/
static int (*__pyx_f_4cupy_4cuda_6device__enable_peer_access)(int, int); /*proto*/

/* Module declarations from "cupy.cuda.memory" */

/* Module declarations from "cupy._core.core" */
static struct __pyx_obj_4cupy_4cuda_8function_Module *(*__pyx_f_4cupy_5_core_4core_compile_with_cache)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_compile_with_cache *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*__pyx_f_4cupy_5_core_4core_array)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_array *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*__pyx_f_4cupy_5_core_4core__convert_object_with_cuda_array_interface)(PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(*__pyx_f_4cupy_5_core_4core__ndarray_init)(PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_f_4cupy_5_core_4core__convert_from_cupy_like(PyObject *, PyObject *); /*proto*/

/* Module declarations from "cupy.cuda.texture" */

/* Module declarations from "cupy._core._accelerator" */
static PyObject **__pyx_vp_4cupy_5_core_12_accelerator__elementwise_accelerators = 0;
#define __pyx_v_4cupy_5_core_12_accelerator__elementwise_accelerators (*__pyx_vp_4cupy_5_core_12_accelerator__elementwise_accelerators)
static PyObject **__pyx_vp_4cupy_5_core_12_accelerator__reduction_accelerators = 0;
#define __pyx_v_4cupy_5_core_12_accelerator__reduction_accelerators (*__pyx_vp_4cupy_5_core_12_accelerator__reduction_accelerators)
static PyObject **__pyx_vp_4cupy_5_core_12_accelerator__routine_accelerators = 0;
#define __pyx_v_4cupy_5_core_12_accelerator__routine_accelerators (*__pyx_vp_4cupy_5_core_12_accelerator__routine_accelerators)

/* Module declarations from "cupy._core._dtype" */
static PyObject **__pyx_vp_4cupy_5_core_6_dtype_all_type_chars = 0;
#define __pyx_v_4cupy_5_core_6_dtype_all_type_chars (*__pyx_vp_4cupy_5_core_6_dtype_all_type_chars)
static PyObject **__pyx_vp_4cupy_5_core_6_dtype_all_type_chars_b = 0;
#define __pyx_v_4cupy_5_core_6_dtype_all_type_chars_b (*__pyx_vp_4cupy_5_core_6_dtype_all_type_chars_b)
static PyObject *(*__pyx_f_4cupy_5_core_6_dtype_get_dtype)(PyObject *, int __pyx_skip_dispatch); /*proto*/
static void (*__pyx_f_4cupy_5_core_6_dtype__raise_if_invalid_cast)(PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_6_dtype__raise_if_invalid_cast *__pyx_optional_args); /*proto*/

/* Module declarations from "libcpp.pair" */

/* Module declarations from "cupy._core._memory_range" */
static int (*__pyx_f_4cupy_5_core_13_memory_range_may_share_bounds)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from "cupy._core.internal" */
static int (*__pyx_f_4cupy_5_core_8internal_vector_equal)(std::vector<Py_ssize_t>  const &, std::vector<Py_ssize_t>  const &, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_4cupy_5_core_8internal__broadcast_core)(PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t &); /*proto*/

/* Module declarations from "cupy_backends.cuda.api" */

/* Module declarations from "cupy_backends.cuda.api._driver_enum" */

/* Module declarations from "cupy_backends.cuda.api.driver" */

/* Module declarations from "cupy_backends.cuda.api._runtime_enum" */

/* Module declarations from "cupy_backends.cuda.api.runtime" */
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorMemoryAllocation = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_errorMemoryAllocation (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorMemoryAllocation)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidValue = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_errorInvalidValue (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidValue)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorPeerAccessAlreadyEnabled = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_errorPeerAccessAlreadyEnabled (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorPeerAccessAlreadyEnabled)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorContextIsDestroyed = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_errorContextIsDestroyed (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorContextIsDestroyed)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidResourceHandle = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_errorInvalidResourceHandle (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidResourceHandle)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMajor = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMajor (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMajor)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMinor = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMinor (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMinor)
static int *__pyx_vp_13cupy_backends_4cuda_3api_7runtime__is_hip_environment = 0;
#define __pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment (*__pyx_vp_13cupy_backends_4cuda_3api_7runtime__is_hip_environment)
static int (*__pyx_f_13cupy_backends_4cuda_3api_7runtime_getDevice)(int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_13cupy_backends_4cuda_3api_7runtime_getDeviceProperties)(int, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from "cupy._core._kernel" */
static PyObject *__pyx_v_4cupy_5_core_7_kernel__numpy_can_cast = 0;
static PyObject *__pyx_v_4cupy_5_core_7_kernel__numpy_result_type = 0;
static PyObject *__pyx_f_4cupy_5_core_7_kernel_create_ufunc(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__full_mask_hex(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_arginfos(PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_kernel_params(PyObject *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__broadcast(PyObject *, PyObject *, int, __pyx_t_4cupy_5_core_7_carray_shape_t &); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_out_args_from_optionals(PyObject *, PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_out_args_with_params(PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_5_core_7_kernel__check_peer_access(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_args(int, PyObject *); /*proto*/
static __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_f_4cupy_5_core_7_kernel__reduce_dims(PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &); /*proto*/
static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__contains_zero(__pyx_t_4cupy_5_core_7_carray_shape_t const &); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code(PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code(PyObject *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel(PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_arg(int, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_optional_args(int, PyObject *); /*proto*/
static __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_f_4cupy_5_core_7_kernel__reduced_view_core(PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__decide_params_type_core(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__copy_in_args_if_needed(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_fix_cast_expr(PyObject *, PyObject *, PyObject *); /*proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_ufunc_kernel(PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__get_kind_score(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__check_should_use_weak_scalar(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__ArgInfo__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ParameterInfo__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__TypeMap__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ElementwiseKernel__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ufunc__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Op__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__Op *, PyObject *); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Ops__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "cupy._core._kernel"
extern int __pyx_module_is_main_cupy___core___kernel;
int __pyx_module_is_main_cupy___core___kernel = 0;

/* Implementation of "cupy._core._kernel" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_map;
/* #### Code section: string_decls ### */
static const char __pyx_k_pairs_2[] = "_pairs";
static const char __pyx_k_nin_nout_ops_promote_types[] = "nin, nout, ops, promote_types";
static const char __pyx_k_ctype_dtype_is_const_name_raw[] = "ctype, dtype, is_const, name, raw";
static const char __pyx_k_doc_____name____cutensor_alpha[] = "__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout";
static const char __pyx_k_name____cached_codes__elementw[] = "__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple";
static const char __pyx_k_in_dtypes__out_dtypes__resoluti[] = "_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine";
static const char __pyx_k_arg_kind_c_contiguous_dtype_inde[] = "arg_kind, c_contiguous, dtype, index_32_bits, ndim, type";
/* #### Code section: decls ### */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel__get_warpsize(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_2_full_mask(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_full_mask_hex(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_6_check_peer_access(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr, int __pyx_v_device_id); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo___init__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_6__repr__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4type___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_5dtype___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4ndim___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v_param, int __pyx_v_is_const); /* proto */
static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_6__repr__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5dtype___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5ctype___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_3raw___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8is_const___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_get_param_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_is_const); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_10_decide_params_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_params, PyObject *__pyx_v_out_params, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap___init__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_pairs); /* proto */
static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6__str__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs___get__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_2__set__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_4__del__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_12_get_elementwise_kernel_code(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_after_loop, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_14_get_elementwise_kernel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_after_loop, PyObject *__pyx_v_options); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_params, PyObject *__pyx_v_out_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_reduce_dims, PyObject *__pyx_v_preamble, PyObject *__pyx_v_no_return, PyObject *__pyx_v_return_tuple, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4_decide_params_type(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6_get_elementwise_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, int __pyx_v_dev_id, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_nin, PyObject *__pyx_v_nout, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_ops, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_doc, PyObject *__pyx_v_default_casting, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops, PyObject *__pyx_v_cutensor_op, PyObject *__pyx_v_scatter_op); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_2__repr__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_5types___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__call___issubclass1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_classinfo); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4__call__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_6outer(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8at(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_indices, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_10reduce(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out, PyObject *__pyx_v_keepdims); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12accumulate(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_14reduceat(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_indices, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_5nargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8_out_ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_9_preamble___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_10_loop_prep___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_16_default_casting___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_11_scatter_op___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_7_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_18_params_with_where___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_14_routine_cache___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_doc___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___2__set__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___4__del__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__name_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_16__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_18__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_16_ufunc_doc_signature_formatter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ufunc, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_3_Op___init__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_types, PyObject *__pyx_v_out_types, PyObject *__pyx_v_routine, PyObject *__pyx_v_error_func, PyObject *__pyx_v_resolution_func); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_2resolve_dtypes(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_args, PyObject *__pyx_v_out_args); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_4__repr__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_8in_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_9out_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_7routine___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_10error_func___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_16_resolution_func___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_10_in_dtypes___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_11_out_dtypes___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_6__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_8__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_4cupy_5_core_7_kernel_4_Ops___init__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_ops, PyObject *__pyx_v_promote_types); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_2guess_routine(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_in_args, PyObject *__pyx_v_dtype, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_4_guess_routine_from_in_types(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_in_types, PyObject *__pyx_v_weaks, PyObject *__pyx_v_can_cast); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_6_guess_routine_from_dtype(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_dtype); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_3ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_13promote_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_18create_ufunc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_ops, PyObject *__pyx_v_routine, PyObject *__pyx_v_preamble, PyObject *__pyx_v_doc, PyObject *__pyx_v_default_casting, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_out_ops, PyObject *__pyx_v_cutensor_op, PyObject *__pyx_v_scatter_op, PyObject *__pyx_v_promote_types); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_20__pyx_unpickle__ArgInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_22__pyx_unpickle_ParameterInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_24__pyx_unpickle__TypeMap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_26__pyx_unpickle_ElementwiseKernel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_28__pyx_unpickle_ufunc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30__pyx_unpickle__Op(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_5_core_7_kernel_32__pyx_unpickle__Ops(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ParameterInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__TypeMap(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__Op(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__Ops(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ElementwiseKernel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ufunc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_8function_CPointer;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_8function_Function;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_8function_Module;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_8function_LinkState;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_carray_mdspan;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_carray_CArray;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_carray_CIndexer;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_carray_Indexer;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  PyTypeObject *__pyx_ptype_5numpy_dtype;
  PyTypeObject *__pyx_ptype_5numpy_flatiter;
  PyTypeObject *__pyx_ptype_5numpy_broadcast;
  PyTypeObject *__pyx_ptype_5numpy_ndarray;
  PyTypeObject *__pyx_ptype_5numpy_generic;
  PyTypeObject *__pyx_ptype_5numpy_number;
  PyTypeObject *__pyx_ptype_5numpy_integer;
  PyTypeObject *__pyx_ptype_5numpy_signedinteger;
  PyTypeObject *__pyx_ptype_5numpy_unsignedinteger;
  PyTypeObject *__pyx_ptype_5numpy_inexact;
  PyTypeObject *__pyx_ptype_5numpy_floating;
  PyTypeObject *__pyx_ptype_5numpy_complexfloating;
  PyTypeObject *__pyx_ptype_5numpy_flexible;
  PyTypeObject *__pyx_ptype_5numpy_character;
  PyTypeObject *__pyx_ptype_5numpy_ufunc;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_scalar_CScalar;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6device_Handle;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6device_Device;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_BaseMemory;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_SystemMemory;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_MemoryPool;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocatorMemory;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator;
  PyTypeObject *__pyx_ptype_4cupy_5_core_4core__ndarray_base;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_ChannelFormatDescriptor;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_ResourceDescriptor;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_TextureDescriptor;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_CUDAarray;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_TextureObject;
  PyTypeObject *__pyx_ptype_4cupy_4cuda_7texture_SurfaceObject;
  PyTypeObject *__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_PointerAttributes;
  PyTypeObject *__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_MemPoolProps;
  PyObject *__pyx_type_4cupy_5_core_7_kernel_ParameterInfo;
  PyObject *__pyx_type_4cupy_5_core_7_kernel__ArgInfo;
  PyObject *__pyx_type_4cupy_5_core_7_kernel__TypeMap;
  PyObject *__pyx_type_4cupy_5_core_7_kernel__Op;
  PyObject *__pyx_type_4cupy_5_core_7_kernel__Ops;
  PyObject *__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel;
  PyObject *__pyx_type_4cupy_5_core_7_kernel_ufunc;
  PyObject *__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr;
  PyObject *__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr;
  PyObject *__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr;
  PyObject *__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel__TypeMap;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel__Op;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel__Ops;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel_ufunc;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr;
  PyTypeObject *__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type__strip;
  PyObject *__pyx_k__21;
  PyObject *__pyx_tuple[6];
  PyObject *__pyx_codeobj_tab[4];
  PyObject *__pyx_string_tab[343];
  PyObject *__pyx_number_tab[13];
/* #### Code section: module_state_contents ### */
/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif


#if CYTHON_USE_FREELISTS
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr[8];
int __pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr[8];
int __pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr[8];
int __pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr[8];
int __pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr;
#endif
/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_0123456789 __pyx_string_tab[1]
#define __pyx_kp_u_1_0 __pyx_string_tab[2]
#define __pyx_kp_u_ArgInfo __pyx_string_tab[3]
#define __pyx_kp_u_CArray __pyx_string_tab[4]
#define __pyx_kp_u_CIndexer __pyx_string_tab[5]
#define __pyx_kp_u_CIndexer__ind __pyx_string_tab[6]
#define __pyx_kp_u_Can_not_use_i_as_a_parameter_nam __pyx_string_tab[7]
#define __pyx_kp_u_Cannot_cast_array_data_from __pyx_string_tab[8]
#define __pyx_kp_u_Cannot_specify_out_as_both_a_pos __pyx_string_tab[9]
#define __pyx_kp_u_Expected_string_or_list_for_typ __pyx_string_tab[10]
#define __pyx_kp_u_Invalid_kernel_name_s __pyx_string_tab[11]
#define __pyx_kp_u_Loop_size_is_undecided __pyx_string_tab[12]
#define __pyx_kp_u_Need_array_or_CScalar_got __pyx_string_tab[13]
#define __pyx_kp_u_No_codes_are_cached_because_comp __pyx_string_tab[14]
#define __pyx_kp_u_None __pyx_string_tab[15]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[16]
#define __pyx_kp_u_Out_shape_is_mismatched __pyx_string_tab[17]
#define __pyx_kp_u_Output_arguments_must_be_cupy_nd __pyx_string_tab[18]
#define __pyx_kp_u_Output_arguments_type_must_be_cu __pyx_string_tab[19]
#define __pyx_kp_u_Output_array_size_is_Undecided __pyx_string_tab[20]
#define __pyx_kp_u_ParameterInfo __pyx_string_tab[21]
#define __pyx_kp_u_Peer_access_has_been_activated __pyx_string_tab[22]
#define __pyx_kp_u_Peer_access_is_unavailable_betw __pyx_string_tab[23]
#define __pyx_kp_u_Specified_size_can_be_used_only __pyx_string_tab[24]
#define __pyx_kp_u_Syntax_error_s __pyx_string_tab[25]
#define __pyx_kp_u_T__where __pyx_string_tab[26]
#define __pyx_kp_u_T_in_d __pyx_string_tab[27]
#define __pyx_kp_u_T_out_d __pyx_string_tab[28]
#define __pyx_kp_u_The_device_where_the_array_resid __pyx_string_tab[29]
#define __pyx_kp_u_The_input_types_of_the_kernel_co __pyx_string_tab[30]
#define __pyx_kp_u_The_out_tuple_must_have_exactly __pyx_string_tab[31]
#define __pyx_kp_u_TypeMap __pyx_string_tab[32]
#define __pyx_kp_u_Type_is_mismatched __pyx_string_tab[33]
#define __pyx_kp_u_Unknown_keyword_s __pyx_string_tab[34]
#define __pyx_kp_u_Wrong_arguments_s __pyx_string_tab[35]
#define __pyx_kp_u_Wrong_number_of_arguments_for_r __pyx_string_tab[36]
#define __pyx_kp_u_Wrong_type __pyx_string_tab[37]
#define __pyx_kp_u__10 __pyx_string_tab[38]
#define __pyx_kp_u__11 __pyx_string_tab[39]
#define __pyx_kp_u__12 __pyx_string_tab[40]
#define __pyx_kp_u__13 __pyx_string_tab[41]
#define __pyx_kp_u__14 __pyx_string_tab[42]
#define __pyx_kp_u__15 __pyx_string_tab[43]
#define __pyx_kp_u__16 __pyx_string_tab[44]
#define __pyx_kp_u__17 __pyx_string_tab[45]
#define __pyx_kp_u__18 __pyx_string_tab[46]
#define __pyx_kp_u__2 __pyx_string_tab[47]
#define __pyx_kp_u__20 __pyx_string_tab[48]
#define __pyx_kp_u__22 __pyx_string_tab[49]
#define __pyx_kp_u__23 __pyx_string_tab[50]
#define __pyx_kp_u__3 __pyx_string_tab[51]
#define __pyx_kp_u__4 __pyx_string_tab[52]
#define __pyx_kp_u__5 __pyx_string_tab[53]
#define __pyx_kp_u__6 __pyx_string_tab[54]
#define __pyx_kp_u__7 __pyx_string_tab[55]
#define __pyx_kp_u__8 __pyx_string_tab[56]
#define __pyx_kp_u__9 __pyx_string_tab[57]
#define __pyx_kp_u_according_to_the_rule_safe __pyx_string_tab[58]
#define __pyx_kp_u_accumulate_is_not_supported_yet __pyx_string_tab[59]
#define __pyx_kp_u_add_note __pyx_string_tab[60]
#define __pyx_kp_u_arg_kind_r __pyx_string_tab[61]
#define __pyx_kp_u_at_is_not_supported_yet __pyx_string_tab[62]
#define __pyx_kp_u_block_size_must_be_greater_than __pyx_string_tab[63]
#define __pyx_kp_u_c_contiguous_r __pyx_string_tab[64]
#define __pyx_kp_u_casting_2 __pyx_string_tab[65]
#define __pyx_kp_u_const __pyx_string_tab[66]
#define __pyx_kp_u_const_2 __pyx_string_tab[67]
#define __pyx_kp_u_const_t_n__raw__n__ind_get __pyx_string_tab[68]
#define __pyx_kp_u_ctype_r __pyx_string_tab[69]
#define __pyx_kp_u_cupy__core__kernel__Op __pyx_string_tab[70]
#define __pyx_kp_u_cupy__core__kernel_pyx __pyx_string_tab[71]
#define __pyx_kp_u_device___int__hip_bool_cast_l __pyx_string_tab[72]
#define __pyx_kp_u_disable __pyx_string_tab[73]
#define __pyx_kp_u_dtype_None __pyx_string_tab[74]
#define __pyx_kp_u_dtype_r __pyx_string_tab[75]
#define __pyx_kp_u_enable __pyx_string_tab[76]
#define __pyx_kp_u_error_func_2 __pyx_string_tab[77]
#define __pyx_kp_u_expected_callable __pyx_string_tab[78]
#define __pyx_kp_u_expected_string_or_list __pyx_string_tab[79]
#define __pyx_kp_u_gc __pyx_string_tab[80]
#define __pyx_kp_u_got __pyx_string_tab[81]
#define __pyx_kp_u_has_incorrect_type_expected __pyx_string_tab[82]
#define __pyx_kp_u_hip_bool_cast __pyx_string_tab[83]
#define __pyx_kp_u_if__raw__where__ind_get_continue __pyx_string_tab[84]
#define __pyx_kp_u_if__where_continue __pyx_string_tab[85]
#define __pyx_kp_u_in_d __pyx_string_tab[86]
#define __pyx_kp_u_ind_get __pyx_string_tab[87]
#define __pyx_kp_u_index_32_bits_r __pyx_string_tab[88]
#define __pyx_kp_u_invalid_op __pyx_string_tab[89]
#define __pyx_kp_u_is_const_r __pyx_string_tab[90]
#define __pyx_kp_u_is_different_from_the_current_d __pyx_string_tab[91]
#define __pyx_kp_u_isenabled __pyx_string_tab[92]
#define __pyx_kp_u_name_in_args_out_args_kwargs __pyx_string_tab[93]
#define __pyx_kp_u_name_r __pyx_string_tab[94]
#define __pyx_kp_u_ndim_r __pyx_string_tab[95]
#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[96]
#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[97]
#define __pyx_kp_u_of_arguments_for __pyx_string_tab[98]
#define __pyx_kp_u_out_2 __pyx_string_tab[99]
#define __pyx_kp_u_out_3 __pyx_string_tab[100]
#define __pyx_kp_u_out_None __pyx_string_tab[101]
#define __pyx_kp_u_out_d __pyx_string_tab[102]
#define __pyx_kp_u_out_must_be_a_tuple_of_arrays __pyx_string_tab[103]
#define __pyx_kp_u_output_operand __pyx_string_tab[104]
#define __pyx_kp_u_positional_out_default __pyx_string_tab[105]
#define __pyx_kp_u_raw_r __pyx_string_tab[106]
#define __pyx_kp_u_real __pyx_string_tab[107]
#define __pyx_kp_u_reduce_is_not_supported_yet __pyx_string_tab[108]
#define __pyx_kp_u_reduceat_is_not_supported_yet __pyx_string_tab[109]
#define __pyx_kp_u_routine_2 __pyx_string_tab[110]
#define __pyx_kp_u_std_c_17 __pyx_string_tab[111]
#define __pyx_kp_u_t_n__raw__n__ind_get __pyx_string_tab[112]
#define __pyx_kp_u_to __pyx_string_tab[113]
#define __pyx_kp_u_type_decls_typedef_preamble_pre __pyx_string_tab[114]
#define __pyx_kp_u_type_r __pyx_string_tab[115]
#define __pyx_kp_u_typedef __pyx_string_tab[116]
#define __pyx_kp_u_ufunc_s __pyx_string_tab[117]
#define __pyx_kp_u_wrong_nin_or_nout __pyx_string_tab[118]
#define __pyx_n_u_A __pyx_string_tab[119]
#define __pyx_n_u_ArgInfo_2 __pyx_string_tab[120]
#define __pyx_n_u_B __pyx_string_tab[121]
#define __pyx_n_u_CIndexer_2 __pyx_string_tab[122]
#define __pyx_n_u_ElementwiseKernel __pyx_string_tab[123]
#define __pyx_n_u_Op __pyx_string_tab[124]
#define __pyx_n_u_Ops __pyx_string_tab[125]
#define __pyx_n_u_ParameterInfo_2 __pyx_string_tab[126]
#define __pyx_n_u_PerformanceWarning __pyx_string_tab[127]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[128]
#define __pyx_n_u_Template __pyx_string_tab[129]
#define __pyx_n_u_TypeMap_2 __pyx_string_tab[130]
#define __pyx_n_u_ULL __pyx_string_tab[131]
#define __pyx_n_u__19 __pyx_string_tab[132]
#define __pyx_n_u_a __pyx_string_tab[133]
#define __pyx_n_u_add_reduceat __pyx_string_tab[134]
#define __pyx_n_u_after_loop __pyx_string_tab[135]
#define __pyx_n_u_append __pyx_string_tab[136]
#define __pyx_n_u_arginfos __pyx_string_tab[137]
#define __pyx_n_u_arr __pyx_string_tab[138]
#define __pyx_n_u_array __pyx_string_tab[139]
#define __pyx_n_u_axis __pyx_string_tab[140]
#define __pyx_n_u_b __pyx_string_tab[141]
#define __pyx_n_u_block_size __pyx_string_tab[142]
#define __pyx_n_u_bool __pyx_string_tab[143]
#define __pyx_n_u_c __pyx_string_tab[144]
#define __pyx_n_u_cache __pyx_string_tab[145]
#define __pyx_n_u_call_ufunc __pyx_string_tab[146]
#define __pyx_n_u_can_cast __pyx_string_tab[147]
#define __pyx_n_u_casting __pyx_string_tab[148]
#define __pyx_n_u_char __pyx_string_tab[149]
#define __pyx_n_u_class_getitem __pyx_string_tab[150]
#define __pyx_n_u_classinfo __pyx_string_tab[151]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[152]
#define __pyx_n_u_close __pyx_string_tab[153]
#define __pyx_n_u_cls __pyx_string_tab[154]
#define __pyx_n_u_compiler __pyx_string_tab[155]
#define __pyx_n_u_ctype __pyx_string_tab[156]
#define __pyx_n_u_cudaTextureObject_t __pyx_string_tab[157]
#define __pyx_n_u_cuda_array_interface __pyx_string_tab[158]
#define __pyx_n_u_cuda_cutensor __pyx_string_tab[159]
#define __pyx_n_u_cumprod __pyx_string_tab[160]
#define __pyx_n_u_cumsum __pyx_string_tab[161]
#define __pyx_n_u_cupy __pyx_string_tab[162]
#define __pyx_n_u_cupy__core __pyx_string_tab[163]
#define __pyx_n_u_cupy__core__kernel __pyx_string_tab[164]
#define __pyx_n_u_cupy__core__scalar __pyx_string_tab[165]
#define __pyx_n_u_cupy_add __pyx_string_tab[166]
#define __pyx_n_u_cupy_backends_cuda_api __pyx_string_tab[167]
#define __pyx_n_u_cupy_backends_cuda_libs __pyx_string_tab[168]
#define __pyx_n_u_cupy_cuda __pyx_string_tab[169]
#define __pyx_n_u_cupy_get_ndarray __pyx_string_tab[170]
#define __pyx_n_u_cupy_multiply __pyx_string_tab[171]
#define __pyx_n_u_cupy_override_elementwise_kern __pyx_string_tab[172]
#define __pyx_n_u_cupyx_cutensor __pyx_string_tab[173]
#define __pyx_n_u_cutensor __pyx_string_tab[174]
#define __pyx_n_u_cutensor_op __pyx_string_tab[175]
#define __pyx_n_u_d __pyx_string_tab[176]
#define __pyx_n_u_decide_params_type __pyx_string_tab[177]
#define __pyx_n_u_default __pyx_string_tab[178]
#define __pyx_n_u_default_casting __pyx_string_tab[179]
#define __pyx_n_u_default_casting_2 __pyx_string_tab[180]
#define __pyx_n_u_dev_id __pyx_string_tab[181]
#define __pyx_n_u_device_id __pyx_string_tab[182]
#define __pyx_n_u_dict __pyx_string_tab[183]
#define __pyx_n_u_doc __pyx_string_tab[184]
#define __pyx_n_u_driver __pyx_string_tab[185]
#define __pyx_n_u_driver_2 __pyx_string_tab[186]
#define __pyx_n_u_dtype __pyx_string_tab[187]
#define __pyx_n_u_enumerate __pyx_string_tab[188]
#define __pyx_n_u_error_func __pyx_string_tab[189]
#define __pyx_n_u_for_each_device __pyx_string_tab[190]
#define __pyx_n_u_format __pyx_string_tab[191]
#define __pyx_n_u_full_mask __pyx_string_tab[192]
#define __pyx_n_u_fusion_thread_local __pyx_string_tab[193]
#define __pyx_n_u_genexpr __pyx_string_tab[194]
#define __pyx_n_u_get __pyx_string_tab[195]
#define __pyx_n_u_get_build_version __pyx_string_tab[196]
#define __pyx_n_u_get_elementwise_kernel __pyx_string_tab[197]
#define __pyx_n_u_get_elementwise_kernel_code __pyx_string_tab[198]
#define __pyx_n_u_get_param_info __pyx_string_tab[199]
#define __pyx_n_u_get_typename __pyx_string_tab[200]
#define __pyx_n_u_get_typename_2 __pyx_string_tab[201]
#define __pyx_n_u_get_warpsize __pyx_string_tab[202]
#define __pyx_n_u_getstate __pyx_string_tab[203]
#define __pyx_n_u_guess_routine __pyx_string_tab[204]
#define __pyx_n_u_guess_routine_from_dtype __pyx_string_tab[205]
#define __pyx_n_u_guess_routine_from_in_types __pyx_string_tab[206]
#define __pyx_n_u_i __pyx_string_tab[207]
#define __pyx_n_u_in_args __pyx_string_tab[208]
#define __pyx_n_u_in_args_dtype __pyx_string_tab[209]
#define __pyx_n_u_in_params __pyx_string_tab[210]
#define __pyx_n_u_in_types __pyx_string_tab[211]
#define __pyx_n_u_indices __pyx_string_tab[212]
#define __pyx_n_u_inexact __pyx_string_tab[213]
#define __pyx_n_u_init___locals_genexpr __pyx_string_tab[214]
#define __pyx_n_u_integer __pyx_string_tab[215]
#define __pyx_n_u_is_const __pyx_string_tab[216]
#define __pyx_n_u_is_fusing __pyx_string_tab[217]
#define __pyx_n_u_is_hip_7_plus __pyx_string_tab[218]
#define __pyx_n_u_is_valid_kernel_name __pyx_string_tab[219]
#define __pyx_n_u_items __pyx_string_tab[220]
#define __pyx_n_u_itemsize __pyx_string_tab[221]
#define __pyx_n_u_keepdims __pyx_string_tab[222]
#define __pyx_n_u_kernel __pyx_string_tab[223]
#define __pyx_n_u_kind __pyx_string_tab[224]
#define __pyx_n_u_kwargs __pyx_string_tab[225]
#define __pyx_n_u_loop_prep __pyx_string_tab[226]
#define __pyx_n_u_main __pyx_string_tab[227]
#define __pyx_n_u_map __pyx_string_tab[228]
#define __pyx_n_u_memoize __pyx_string_tab[229]
#define __pyx_n_u_module __pyx_string_tab[230]
#define __pyx_n_u_n __pyx_string_tab[231]
#define __pyx_n_u_name __pyx_string_tab[232]
#define __pyx_n_u_name_2 __pyx_string_tab[233]
#define __pyx_n_u_ndarray __pyx_string_tab[234]
#define __pyx_n_u_ndim __pyx_string_tab[235]
#define __pyx_n_u_new __pyx_string_tab[236]
#define __pyx_n_u_newbyteorder __pyx_string_tab[237]
#define __pyx_n_u_next __pyx_string_tab[238]
#define __pyx_n_u_nin __pyx_string_tab[239]
#define __pyx_n_u_no_return __pyx_string_tab[240]
#define __pyx_n_u_non_const __pyx_string_tab[241]
#define __pyx_n_u_nout __pyx_string_tab[242]
#define __pyx_n_u_numpy __pyx_string_tab[243]
#define __pyx_n_u_operation __pyx_string_tab[244]
#define __pyx_n_u_ops __pyx_string_tab[245]
#define __pyx_n_u_options __pyx_string_tab[246]
#define __pyx_n_u_out __pyx_string_tab[247]
#define __pyx_n_u_out_args __pyx_string_tab[248]
#define __pyx_n_u_out_args_dtype __pyx_string_tab[249]
#define __pyx_n_u_out_ops __pyx_string_tab[250]
#define __pyx_n_u_out_params __pyx_string_tab[251]
#define __pyx_n_u_out_types __pyx_string_tab[252]
#define __pyx_n_u_pairs __pyx_string_tab[253]
#define __pyx_n_u_param __pyx_string_tab[254]
#define __pyx_n_u_params __pyx_string_tab[255]
#define __pyx_n_u_pop __pyx_string_tab[256]
#define __pyx_n_u_positional __pyx_string_tab[257]
#define __pyx_n_u_preamble __pyx_string_tab[258]
#define __pyx_n_u_prod __pyx_string_tab[259]
#define __pyx_n_u_promote_types __pyx_string_tab[260]
#define __pyx_n_u_pyx_capi __pyx_string_tab[261]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[262]
#define __pyx_n_u_pyx_state __pyx_string_tab[263]
#define __pyx_n_u_pyx_type __pyx_string_tab[264]
#define __pyx_n_u_pyx_unpickle_ElementwiseKernel __pyx_string_tab[265]
#define __pyx_n_u_pyx_unpickle_ParameterInfo __pyx_string_tab[266]
#define __pyx_n_u_pyx_unpickle__ArgInfo __pyx_string_tab[267]
#define __pyx_n_u_pyx_unpickle__Op __pyx_string_tab[268]
#define __pyx_n_u_pyx_unpickle__Ops __pyx_string_tab[269]
#define __pyx_n_u_pyx_unpickle__TypeMap __pyx_string_tab[270]
#define __pyx_n_u_pyx_unpickle_ufunc __pyx_string_tab[271]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[272]
#define __pyx_n_u_qualname __pyx_string_tab[273]
#define __pyx_n_u_raw __pyx_string_tab[274]
#define __pyx_n_u_raw_2 __pyx_string_tab[275]
#define __pyx_n_u_reduce __pyx_string_tab[276]
#define __pyx_n_u_reduce_cython __pyx_string_tab[277]
#define __pyx_n_u_reduce_dims __pyx_string_tab[278]
#define __pyx_n_u_reduce_ex __pyx_string_tab[279]
#define __pyx_n_u_reshape __pyx_string_tab[280]
#define __pyx_n_u_resolution_func __pyx_string_tab[281]
#define __pyx_n_u_resolve_dtypes __pyx_string_tab[282]
#define __pyx_n_u_result_type __pyx_string_tab[283]
#define __pyx_n_u_return_tuple __pyx_string_tab[284]
#define __pyx_n_u_routine __pyx_string_tab[285]
#define __pyx_n_u_rstrip __pyx_string_tab[286]
#define __pyx_n_u_s __pyx_string_tab[287]
#define __pyx_n_u_same_kind __pyx_string_tab[288]
#define __pyx_n_u_scatter_op __pyx_string_tab[289]
#define __pyx_n_u_scatter_op_2 __pyx_string_tab[290]
#define __pyx_n_u_send __pyx_string_tab[291]
#define __pyx_n_u_set_name __pyx_string_tab[292]
#define __pyx_n_u_setdefault __pyx_string_tab[293]
#define __pyx_n_u_setstate __pyx_string_tab[294]
#define __pyx_n_u_setstate_cython __pyx_string_tab[295]
#define __pyx_n_u_shape __pyx_string_tab[296]
#define __pyx_n_u_size __pyx_string_tab[297]
#define __pyx_n_u_split __pyx_string_tab[298]
#define __pyx_n_u_stream __pyx_string_tab[299]
#define __pyx_n_u_string __pyx_string_tab[300]
#define __pyx_n_u_strip __pyx_string_tab[301]
#define __pyx_n_u_substitute __pyx_string_tab[302]
#define __pyx_n_u_sum __pyx_string_tab[303]
#define __pyx_n_u_t __pyx_string_tab[304]
#define __pyx_n_u_test __pyx_string_tab[305]
#define __pyx_n_u_throw __pyx_string_tab[306]
#define __pyx_n_u_try_elementwise_binary_routine __pyx_string_tab[307]
#define __pyx_n_u_type __pyx_string_tab[308]
#define __pyx_n_u_type_2 __pyx_string_tab[309]
#define __pyx_n_u_type_decls __pyx_string_tab[310]
#define __pyx_n_u_type_map __pyx_string_tab[311]
#define __pyx_n_u_typedef_preamble __pyx_string_tab[312]
#define __pyx_n_u_ufunc __pyx_string_tab[313]
#define __pyx_n_u_ufunc_doc_signature_formatter __pyx_string_tab[314]
#define __pyx_n_u_ufunc_doc_signature_formatter_l __pyx_string_tab[315]
#define __pyx_n_u_update __pyx_string_tab[316]
#define __pyx_n_u_util __pyx_string_tab[317]
#define __pyx_n_u_value __pyx_string_tab[318]
#define __pyx_n_u_values __pyx_string_tab[319]
#define __pyx_n_u_warn __pyx_string_tab[320]
#define __pyx_n_u_warnings __pyx_string_tab[321]
#define __pyx_n_u_warpSize __pyx_string_tab[322]
#define __pyx_n_u_weaks __pyx_string_tab[323]
#define __pyx_n_u_where __pyx_string_tab[324]
#define __pyx_n_u_x __pyx_string_tab[325]
#define __pyx_n_u_zip __pyx_string_tab[326]
#define __pyx_kp_b_PyObject_PyObject_PyObject_PyObj __pyx_string_tab[327]
#define __pyx_kp_b_PyObject_PyObject___pyx_t_4cupy __pyx_string_tab[328]
#define __pyx_kp_b_PyObject_PyObject_int___pyx_skip __pyx_string_tab[329]
#define __pyx_kp_b_PyObject_PyObject_int___pyx_skip_2 __pyx_string_tab[330]
#define __pyx_kp_b_PyObject__elementwise_accelerato __pyx_string_tab[331]
#define __pyx_kp_b_PyObject_all_type_chars_all_type __pyx_string_tab[332]
#define __pyx_kp_b_PyObject_int_int___pyx_skip_disp __pyx_string_tab[333]
#define __pyx_kp_b_PyObject_scalar_type_set __pyx_string_tab[334]
#define __pyx_kp_b_int__is_hip_environment_deviceAt __pyx_string_tab[335]
#define __pyx_kp_b_int_int___pyx_skip_dispatch_int __pyx_string_tab[336]
#define __pyx_kp_b_int_struct___pyx_obj_4cupy_5_cor __pyx_string_tab[337]
#define __pyx_kp_b_iso88591_A_2 __pyx_string_tab[338]
#define __pyx_kp_b_iso88591__24 __pyx_string_tab[339]
#define __pyx_kp_b_iso88591_a_2 __pyx_string_tab[340]
#define __pyx_kp_b_struct___pyx_obj_4cupy_4cuda_8fu __pyx_string_tab[341]
#define __pyx_kp_b_struct___pyx_obj_4cupy_5_core_7 __pyx_string_tab[342]
#define __pyx_int_0 __pyx_number_tab[0]
#define __pyx_int_neg_1 __pyx_number_tab[1]
#define __pyx_int_1 __pyx_number_tab[2]
#define __pyx_int_128 __pyx_number_tab[3]
#define __pyx_int_17460680 __pyx_number_tab[4]
#define __pyx_int_27370516 __pyx_number_tab[5]
#define __pyx_int_70000000 __pyx_number_tab[6]
#define __pyx_int_75976750 __pyx_number_tab[7]
#define __pyx_int_129642355 __pyx_number_tab[8]
#define __pyx_int_202451496 __pyx_number_tab[9]
#define __pyx_int_216642581 __pyx_number_tab[10]
#define __pyx_int_264656072 __pyx_number_tab[11]
#define __pyx_int_4294967295 __pyx_number_tab[12]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_8function_CPointer);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_8function_Function);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_8function_Module);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_8function_LinkState);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_carray_mdspan);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_carray_CArray);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_carray_CIndexer);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_carray_Indexer);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_scalar_CScalar);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6device_Handle);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6device_Device);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_BaseMemory);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_SystemMemory);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_MemoryPool);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocatorMemory);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_4core__ndarray_base);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_ChannelFormatDescriptor);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_ResourceDescriptor);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_TextureDescriptor);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_CUDAarray);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_TextureObject);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_4cuda_7texture_SurfaceObject);
  Py_CLEAR(clear_module_state->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_PointerAttributes);
  Py_CLEAR(clear_module_state->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_MemPoolProps);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel_ParameterInfo);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel__ArgInfo);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel__TypeMap);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel__Op);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel__Op);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel__Ops);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel__Ops);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ufunc);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel_ufunc);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_k__21);
  for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<343; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<13; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_8function_CPointer);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_8function_Function);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_8function_Module);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_8function_LinkState);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_carray_mdspan);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_carray_CArray);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_carray_CIndexer);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_carray_Indexer);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_scalar_CScalar);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6device_Handle);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6device_Device);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_BaseMemory);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_SystemMemory);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_MemoryPool);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocatorMemory);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_4core__ndarray_base);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_ChannelFormatDescriptor);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_ResourceDescriptor);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_TextureDescriptor);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_CUDAarray);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_TextureObject);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_4cuda_7texture_SurfaceObject);
  Py_VISIT(traverse_module_state->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_PointerAttributes);
  Py_VISIT(traverse_module_state->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_MemPoolProps);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel_ParameterInfo);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel__ArgInfo);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel__TypeMap);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel__Op);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel__Op);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel__Ops);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel__Ops);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel_ufunc);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel_ufunc);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_k__21);
  for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<343; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<13; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":243
 *         cdef int type_num
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":245
 *         @property
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyDataType_ELSIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":243
 *         cdef int type_num
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":247
 *             return PyDataType_ELSIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":249
 *         @property
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)             # <<<<<<<<<<<<<<
 * 
 *         # Use fields/names with care as they may be NULL.  You must check
*/
  __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":247
 *             return PyDataType_ELSIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":253
 *         # Use fields/names with care as they may be NULL.  You must check
 *         # for this using PyDataType_HASFIELDS.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("fields", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":255
 *         @property
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":253
 *         # Use fields/names with care as they may be NULL.  You must check
 *         # for this using PyDataType_HASFIELDS.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":257
 *             return <object>PyDataType_FIELDS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("names", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":259
 *         @property
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)             # <<<<<<<<<<<<<<
 * 
 *         # Use PyDataType_HASSUBARRAY to test whether this field is
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDataType_NAMES(__pyx_v_self);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = ((PyObject*)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":257
 *             return <object>PyDataType_FIELDS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":264
 *         # valid (the pointer can be NULL). Most users should access
 *         # this field via the inline helper method PyDataType_SHAPE.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)
*/

static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) {
  PyArray_ArrayDescr *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":266
 *         @property
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyDataType_SUBARRAY(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":264
 *         # valid (the pointer can be NULL). Most users should access
 *         # this field via the inline helper method PyDataType_SHAPE.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":268
 *             return PyDataType_SUBARRAY(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
*/

static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) {
  npy_uint64 __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":271
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
 *             return PyDataType_FLAGS(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyDataType_FLAGS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":268
 *             return PyDataType_SUBARRAY(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":280
 *     ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
*/

static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":283
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
 *             return PyArray_MultiIter_NUMITER(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":280
 *     ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":285
 *             return PyArray_MultiIter_NUMITER(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":288
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
 *             return PyArray_MultiIter_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":285
 *             return PyArray_MultiIter_NUMITER(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":290
 *             return PyArray_MultiIter_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":293
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
 *             return PyArray_MultiIter_INDEX(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":290
 *             return PyArray_MultiIter_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":295
 *             return PyArray_MultiIter_INDEX(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
*/

static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":298
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
 *             return PyArray_MultiIter_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":295
 *             return PyArray_MultiIter_INDEX(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":300
 *             return PyArray_MultiIter_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":303
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
 *             return PyArray_MultiIter_DIMS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":300
 *             return PyArray_MultiIter_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":305
 *             return PyArray_MultiIter_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline void** iters(self) noexcept nogil:
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
*/

static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) {
  void **__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":309
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
 *             On return, the iterators are adjusted for broadcasting."""
 *             return PyArray_MultiIter_ITERS(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":305
 *             return PyArray_MultiIter_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline void** iters(self) noexcept nogil:
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":323
 *         # Instead, we use properties that map to the corresponding C-API functions.
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyObject* base(self) noexcept nogil:
 *             """Returns a borrowed reference to the object owning the data/memory.
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) {
  PyObject *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":327
 *             """Returns a borrowed reference to the object owning the data/memory.
 *             """
 *             return PyArray_BASE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_BASE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":323
 *         # Instead, we use properties that map to the corresponding C-API functions.
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyObject* base(self) noexcept nogil:
 *             """Returns a borrowed reference to the object owning the data/memory.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":329
 *             return PyArray_BASE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline dtype descr(self):
 *             """Returns an owned reference to the dtype of the array.
*/

static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) {
  PyArray_Descr *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArray_Descr *__pyx_t_1;
  __Pyx_RefNannySetupContext("descr", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":333
 *             """Returns an owned reference to the dtype of the array.
 *             """
 *             return <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = PyArray_DESCR(__pyx_v_self);
  __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1));
  __pyx_r = ((PyArray_Descr *)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":329
 *             return PyArray_BASE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline dtype descr(self):
 *             """Returns an owned reference to the dtype of the array.
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":335
 *             return <dtype>PyArray_DESCR(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int ndim(self) noexcept nogil:
 *             """Returns the number of dimensions in the array.
*/

static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":339
 *             """Returns the number of dimensions in the array.
 *             """
 *             return PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_NDIM(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":335
 *             return <dtype>PyArray_DESCR(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int ndim(self) noexcept nogil:
 *             """Returns the number of dimensions in the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":341
 *             return PyArray_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *shape(self) noexcept nogil:
 *             """Returns a pointer to the dimensions/shape of the array.
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":347
 *             Can return NULL for 0-dimensional arrays.
 *             """
 *             return PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_DIMS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":341
 *             return PyArray_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *shape(self) noexcept nogil:
 *             """Returns a pointer to the dimensions/shape of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":349
 *             return PyArray_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *strides(self) noexcept nogil:
 *             """Returns a pointer to the strides of the array.
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":354
 *             The number of elements matches the number of dimensions of the array (ndim).
 *             """
 *             return PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_STRIDES(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":349
 *             return PyArray_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *strides(self) noexcept nogil:
 *             """Returns a pointer to the strides of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":356
 *             return PyArray_STRIDES(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """Returns the total size (in number of elements) of the array.
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":360
 *             """Returns the total size (in number of elements) of the array.
 *             """
 *             return PyArray_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_SIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":356
 *             return PyArray_STRIDES(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """Returns the total size (in number of elements) of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":362
 *             return PyArray_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline char* data(self) noexcept nogil:
 *             """The pointer to the data buffer as a char*.
*/

static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) {
  char *__pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":369
 *             of `PyArray_DATA()` instead, which returns a 'void*'.
 *             """
 *             return PyArray_BYTES(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyArray_BYTES(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":362
 *             return PyArray_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline char* data(self) noexcept nogil:
 *             """The pointer to the data buffer as a char*.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":777
 * ctypedef long double complex clongdouble_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":778
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":777
 * ctypedef long double complex clongdouble_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":780
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":781
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":780
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":783
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":784
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":783
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":786
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":787
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":786
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":789
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":790
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":789
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":792
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":793
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
*/
  __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d);
  if (__pyx_t_1) {

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":794
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape;
    __Pyx_INCREF(((PyObject*)__pyx_t_2));
    __pyx_r = ((PyObject*)__pyx_t_2);
    goto __pyx_L0;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":793
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
*/
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":796
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":792
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":995
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
*/

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":996
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
*/
  Py_INCREF(__pyx_v_base);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":997
 * cdef inline void set_array_base(ndarray arr, object base) except *:
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
*/
  __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 997, __pyx_L1_error)

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":995
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":999
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1000
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
 *     if base is NULL:
 *         return None
*/
  __pyx_v_base = PyArray_BASE(__pyx_v_arr);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1001
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
*/
  __pyx_t_1 = (__pyx_v_base == NULL);
  if (__pyx_t_1) {

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1002
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return <object>base
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1001
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
*/
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1003
 *     if base is NULL:
 *         return None
 *     return <object>base             # <<<<<<<<<<<<<<
 * 
 * # Versions of the import_* functions which are more suitable for
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_base));
  __pyx_r = ((PyObject *)__pyx_v_base);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":999
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1007
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
*/

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1008
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1009
 * cdef inline int import_array() except -1:
 *     try:
 *         __pyx_import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy._core.multiarray failed to import")
*/
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1009, __pyx_L3_error)

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1008
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1010
 *     try:
 *         __pyx_import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.multiarray failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1010, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1011
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy._core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1011, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1011, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1008
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1007
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1013
 *         raise ImportError("numpy._core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
*/

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1014
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1015
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")
*/
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1015, __pyx_L3_error)

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1014
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1016
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.umath failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1016, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1017
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1017, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1017, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1014
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1013
 *         raise ImportError("numpy._core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1019
 *         raise ImportError("numpy._core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
*/

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1020
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1021
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")
*/
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1021, __pyx_L3_error)

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1020
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1022
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.umath failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1022, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1023
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1023, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1023, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1020
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1019
 *         raise ImportError("numpy._core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1026
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
*/

static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1038
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1026
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1041
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
*/

static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1053
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1041
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1056
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
*/

static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
  npy_datetime __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1063
 *     also needed.  That can be found using `get_datetime64_unit`.
 *     """
 *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1056
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1066
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
*/

static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
  npy_timedelta __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1070
 *     returns the int64 value underlying scalar numpy timedelta64 object
 *     """
 *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1066
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1073
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
*/

static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
  NPY_DATETIMEUNIT __pyx_r;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1077
 *     returns the unit part of the dtype for a numpy datetime64 object.
 *     """
 *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
  goto __pyx_L0;

  /* "../../../../usr/lib/python3.14/site-packages/numpy/__init__.cython-30.pxd":1073
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "memory.pxd":77
 *     cdef _ensure_pools_and_return_device_pool(self)
 * 
 *     cdef inline device_pool(self):             # <<<<<<<<<<<<<<
 *         # This criticial section may not be needed in practice. But without it
 *         # `self._pools` could be in an inconsistent state (the `PyObject *`
*/

static CYTHON_INLINE PyObject *__pyx_f_4cupy_4cuda_6memory_10MemoryPool_device_pool(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("device_pool", 0);

  /* "memory.pxd":82
 *         # or the tuple not fully written due to CPU/compiler optimizations).
 *         # Atomics would be another way to ensure complete safety here.
 *         with cython.critical_section(self):             # <<<<<<<<<<<<<<
 *             if self._pools is not None:
 *                 return self._pools[device.get_device_id()]
*/
  {
      __Pyx_PyCriticalSection __pyx_cs;
      __pyx_t_1 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_PyCriticalSection_Begin(&__pyx_cs, (PyObject*)__pyx_t_1);
      /*try:*/ {

        /* "memory.pxd":83
 *         # Atomics would be another way to ensure complete safety here.
 *         with cython.critical_section(self):
 *             if self._pools is not None:             # <<<<<<<<<<<<<<
 *                 return self._pools[device.get_device_id()]
 * 
*/
        __pyx_t_2 = (__pyx_v_self->_pools != ((PyObject*)Py_None));
        if (__pyx_t_2) {

          /* "memory.pxd":84
 *         with cython.critical_section(self):
 *             if self._pools is not None:
 *                 return self._pools[device.get_device_id()]             # <<<<<<<<<<<<<<
 * 
 *         return self._ensure_pools_and_return_device_pool()
*/
          __Pyx_XDECREF(__pyx_r);
          if (unlikely(__pyx_v_self->_pools == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(2, 84, __pyx_L4_error)
          }
          __pyx_t_3 = __pyx_f_4cupy_4cuda_6device_get_device_id(0); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(2, 84, __pyx_L4_error)
          __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_pools, __pyx_t_3, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 84, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_r = __pyx_t_4;
          __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L3_return;

          /* "memory.pxd":83
 *         # Atomics would be another way to ensure complete safety here.
 *         with cython.critical_section(self):
 *             if self._pools is not None:             # <<<<<<<<<<<<<<
 *                 return self._pools[device.get_device_id()]
 * 
*/
        }
      }

      /* "memory.pxd":82
 *         # or the tuple not fully written due to CPU/compiler optimizations).
 *         # Atomics would be another way to ensure complete safety here.
 *         with cython.critical_section(self):             # <<<<<<<<<<<<<<
 *             if self._pools is not None:
 *                 return self._pools[device.get_device_id()]
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_PyCriticalSection_End(&__pyx_cs);
          goto __pyx_L5;
        }
        __pyx_L3_return: {
          __pyx_t_5 = __pyx_r;
          __pyx_r = 0;
          __Pyx_PyCriticalSection_End(&__pyx_cs);
          __pyx_r = __pyx_t_5;
          __pyx_t_5 = 0;
          goto __pyx_L0;
        }
        __pyx_L4_error: {
          __Pyx_PyCriticalSection_End(&__pyx_cs);
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "memory.pxd":86
 *                 return self._pools[device.get_device_id()]
 * 
 *         return self._ensure_pools_and_return_device_pool()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPool *)__pyx_v_self->__pyx_vtab)->_ensure_pools_and_return_device_pool(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "memory.pxd":77
 *     cdef _ensure_pools_and_return_device_pool(self)
 * 
 *     cdef inline device_pool(self):             # <<<<<<<<<<<<<<
 *         # This criticial section may not be needed in practice. But without it
 *         # `self._pools` could be in an inconsistent state (the `PyObject *`
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy.cuda.memory.MemoryPool.device_pool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/core.pxd":125
 * 
 * 
 * cdef inline _ndarray_base _convert_from_cupy_like(             # <<<<<<<<<<<<<<
 *         obj, error):
 *     """Inline function to convert cupy array-likes to cupy ndarray.
*/

static CYTHON_INLINE struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_f_4cupy_5_core_4core__convert_from_cupy_like(PyObject *__pyx_v_obj, PyObject *__pyx_v_error) {
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[6];
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_convert_from_cupy_like", 0);

  /* "cupy/_core/core.pxd":137
 *     is not cupy-like and `None` is returned instead.
 *     """
 *     if isinstance(obj, _ndarray_base):             # <<<<<<<<<<<<<<
 *         return <_ndarray_base>obj
 *     elif hasattr(obj, "__cuda_array_interface__"):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
  if (__pyx_t_1) {

    /* "cupy/_core/core.pxd":138
 *     """
 *     if isinstance(obj, _ndarray_base):
 *         return <_ndarray_base>obj             # <<<<<<<<<<<<<<
 *     elif hasattr(obj, "__cuda_array_interface__"):
 *         return _convert_object_with_cuda_array_interface(obj)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_v_obj));
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_v_obj);
    goto __pyx_L0;

    /* "cupy/_core/core.pxd":137
 *     is not cupy-like and `None` is returned instead.
 *     """
 *     if isinstance(obj, _ndarray_base):             # <<<<<<<<<<<<<<
 *         return <_ndarray_base>obj
 *     elif hasattr(obj, "__cuda_array_interface__"):
*/
  }

  /* "cupy/_core/core.pxd":139
 *     if isinstance(obj, _ndarray_base):
 *         return <_ndarray_base>obj
 *     elif hasattr(obj, "__cuda_array_interface__"):             # <<<<<<<<<<<<<<
 *         return _convert_object_with_cuda_array_interface(obj)
 *     elif hasattr(obj, "__cupy_get_ndarray__"):
*/
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_cuda_array_interface); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 139, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/core.pxd":140
 *         return <_ndarray_base>obj
 *     elif hasattr(obj, "__cuda_array_interface__"):
 *         return _convert_object_with_cuda_array_interface(obj)             # <<<<<<<<<<<<<<
 *     elif hasattr(obj, "__cupy_get_ndarray__"):
 *         return obj.__cupy_get_ndarray__()
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_4core__convert_object_with_cuda_array_interface(__pyx_v_obj, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/core.pxd":139
 *     if isinstance(obj, _ndarray_base):
 *         return <_ndarray_base>obj
 *     elif hasattr(obj, "__cuda_array_interface__"):             # <<<<<<<<<<<<<<
 *         return _convert_object_with_cuda_array_interface(obj)
 *     elif hasattr(obj, "__cupy_get_ndarray__"):
*/
  }

  /* "cupy/_core/core.pxd":141
 *     elif hasattr(obj, "__cuda_array_interface__"):
 *         return _convert_object_with_cuda_array_interface(obj)
 *     elif hasattr(obj, "__cupy_get_ndarray__"):             # <<<<<<<<<<<<<<
 *         return obj.__cupy_get_ndarray__()
 * 
*/
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_cupy_get_ndarray); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 141, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/core.pxd":142
 *         return _convert_object_with_cuda_array_interface(obj)
 *     elif hasattr(obj, "__cupy_get_ndarray__"):
 *         return obj.__cupy_get_ndarray__()             # <<<<<<<<<<<<<<
 * 
 *     if error is not False:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_3 = __pyx_v_obj;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cupy_get_ndarray, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(3, 142, __pyx_L1_error)
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/core.pxd":141
 *     elif hasattr(obj, "__cuda_array_interface__"):
 *         return _convert_object_with_cuda_array_interface(obj)
 *     elif hasattr(obj, "__cupy_get_ndarray__"):             # <<<<<<<<<<<<<<
 *         return obj.__cupy_get_ndarray__()
 * 
*/
  }

  /* "cupy/_core/core.pxd":144
 *         return obj.__cupy_get_ndarray__()
 * 
 *     if error is not False:             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f'{error} has incorrect type '
*/
  __pyx_t_1 = (__pyx_v_error != Py_False);
  if (unlikely(__pyx_t_1)) {

    /* "cupy/_core/core.pxd":145
 * 
 *     if error is not False:
 *         raise TypeError(             # <<<<<<<<<<<<<<
 *             f'{error} has incorrect type '
 *             f'(expected {_ndarray_base}, got {type(obj)}).'
*/
    __pyx_t_3 = NULL;

    /* "cupy/_core/core.pxd":146
 *     if error is not False:
 *         raise TypeError(
 *             f'{error} has incorrect type '             # <<<<<<<<<<<<<<
 *             f'(expected {_ndarray_base}, got {type(obj)}).'
 *         )
*/
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_error, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "cupy/_core/core.pxd":147
 *         raise TypeError(
 *             f'{error} has incorrect type '
 *             f'(expected {_ndarray_base}, got {type(obj)}).'             # <<<<<<<<<<<<<<
 *         )
 * 
*/
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_obj)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8[0] = __pyx_t_5;
    __pyx_t_8[1] = __pyx_mstate_global->__pyx_kp_u_has_incorrect_type_expected;
    __pyx_t_8[2] = __pyx_t_6;
    __pyx_t_8[3] = __pyx_mstate_global->__pyx_kp_u_got;
    __pyx_t_8[4] = __pyx_t_7;
    __pyx_t_8[5] = __pyx_mstate_global->__pyx_kp_u_;

    /* "cupy/_core/core.pxd":146
 *     if error is not False:
 *         raise TypeError(
 *             f'{error} has incorrect type '             # <<<<<<<<<<<<<<
 *             f'(expected {_ndarray_base}, got {type(obj)}).'
 *         )
*/
    __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
    if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 145, __pyx_L1_error)

    /* "cupy/_core/core.pxd":144
 *         return obj.__cupy_get_ndarray__()
 * 
 *     if error is not False:             # <<<<<<<<<<<<<<
 *         raise TypeError(
 *             f'{error} has incorrect type '
*/
  }

  /* "cupy/_core/core.pxd":150
 *         )
 * 
 *     return None             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cupy/_core/core.pxd":125
 * 
 * 
 * cdef inline _ndarray_base _convert_from_cupy_like(             # <<<<<<<<<<<<<<
 *         obj, error):
 *     """Inline function to convert cupy array-likes to cupy ndarray.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cupy._core.core._convert_from_cupy_like", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":23
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         # unavailable in limited API
*/
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":29
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
 *             return self.cval.imag             # <<<<<<<<<<<<<<
 * 
 *     # PyTypeObject PyComplex_Type
*/
  __pyx_r = __pyx_v_self->cval.imag;
  goto __pyx_L0;

  /* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":121
 *     or None if no such value or default was found.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":122
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)             # <<<<<<<<<<<<<<
 *     if value is NULL:
 *         # context variable does not have a default
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 122, __pyx_L1_error)

  /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
  __pyx_t_2 = (__pyx_v_value == NULL);
  if (__pyx_t_2) {

    /* "cpython/contextvars.pxd":125
 *     if value is NULL:
 *         # context variable does not have a default
 *         pyvalue = default_value             # <<<<<<<<<<<<<<
 *     else:
 *         # value or default value of context variable
*/
    __Pyx_INCREF(__pyx_v_default_value);
    __pyx_v_pyvalue = __pyx_v_default_value;

    /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
    goto __pyx_L3;
  }

  /* "cpython/contextvars.pxd":128
 *     else:
 *         # value or default value of context variable
 *         pyvalue = <object>value             # <<<<<<<<<<<<<<
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_value);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_pyvalue = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cpython/contextvars.pxd":129
 *         # value or default value of context variable
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
 * 
*/
    Py_XDECREF(__pyx_v_value);
  }
  __pyx_L3:;

  /* "cpython/contextvars.pxd":130
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_no_default", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":140
 *     Ignores the default value of the context variable, if any.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":141
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)             # <<<<<<<<<<<<<<
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 141, __pyx_L1_error)

  /* "cpython/contextvars.pxd":143
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value             # <<<<<<<<<<<<<<
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_value);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pyvalue = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cpython/contextvars.pxd":144
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
*/
  Py_XDECREF(__pyx_v_value);

  /* "cpython/contextvars.pxd":145
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cupy/_core/_dtype.pxd":23
 * 
 * 
 * cdef inline normalize_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Given an existing NumPy dtype normalize it for cupy.
 * 
*/

static CYTHON_INLINE PyObject *__pyx_f_4cupy_5_core_6_dtype_normalize_dtype(PyObject *__pyx_v_dtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("normalize_dtype", 0);

  /* "cupy/_core/_dtype.pxd":30
 *     user by byte-swapping automatically.
 *     """
 *     return dtype.newbyteorder("<")             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_v_dtype;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__2};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_newbyteorder, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 30, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_dtype.pxd":23
 * 
 * 
 * cdef inline normalize_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Given an existing NumPy dtype normalize it for cupy.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._dtype.normalize_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":41
 * 
 * 
 * cdef inline bint _contains_zero(const shape_t& v) except? -1:             # <<<<<<<<<<<<<<
 *     for i in range(v.size()):
 *         if v[i] == 0:
*/

static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__contains_zero(__pyx_t_4cupy_5_core_7_carray_shape_t const &__pyx_v_v) {
  std::vector<Py_ssize_t> ::size_type __pyx_v_i;
  int __pyx_r;
  std::vector<Py_ssize_t> ::size_type __pyx_t_1;
  std::vector<Py_ssize_t> ::size_type __pyx_t_2;
  std::vector<Py_ssize_t> ::size_type __pyx_t_3;
  int __pyx_t_4;

  /* "cupy/_core/_kernel.pyx":42
 * 
 * cdef inline bint _contains_zero(const shape_t& v) except? -1:
 *     for i in range(v.size()):             # <<<<<<<<<<<<<<
 *         if v[i] == 0:
 *             return True
*/
  __pyx_t_1 = __pyx_v_v.size();
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "cupy/_core/_kernel.pyx":43
 * cdef inline bint _contains_zero(const shape_t& v) except? -1:
 *     for i in range(v.size()):
 *         if v[i] == 0:             # <<<<<<<<<<<<<<
 *             return True
 *     return False
*/
    __pyx_t_4 = ((__pyx_v_v[__pyx_v_i]) == 0);
    if (__pyx_t_4) {

      /* "cupy/_core/_kernel.pyx":44
 *     for i in range(v.size()):
 *         if v[i] == 0:
 *             return True             # <<<<<<<<<<<<<<
 *     return False
 * 
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":43
 * cdef inline bint _contains_zero(const shape_t& v) except? -1:
 *     for i in range(v.size()):
 *         if v[i] == 0:             # <<<<<<<<<<<<<<
 *             return True
 *     return False
*/
    }
  }

  /* "cupy/_core/_kernel.pyx":45
 *         if v[i] == 0:
 *             return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":41
 * 
 * 
 * cdef inline bint _contains_zero(const shape_t& v) except? -1:             # <<<<<<<<<<<<<<
 *     for i in range(v.size()):
 *         if v[i] == 0:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":48
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_warpsize():
 *     device_id = runtime.getDevice()
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_1_get_warpsize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel__get_warpsize, "_get_warpsize()");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_1_get_warpsize = {"_get_warpsize", (PyCFunction)__pyx_pw_4cupy_5_core_7_kernel_1_get_warpsize, METH_NOARGS, __pyx_doc_4cupy_5_core_7_kernel__get_warpsize};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_1_get_warpsize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_warpsize (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel__get_warpsize(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel__get_warpsize(CYTHON_UNUSED PyObject *__pyx_self) {
  int __pyx_v_device_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_warpsize", 0);

  /* "cupy/_core/_kernel.pyx":50
 * @_util.memoize(for_each_device=True)
 * def _get_warpsize():
 *     device_id = runtime.getDevice()             # <<<<<<<<<<<<<<
 *     return runtime.getDeviceProperties(device_id)['warpSize']
 * 
*/
  __pyx_t_1 = __pyx_f_13cupy_backends_4cuda_3api_7runtime_getDevice(0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error)
  __pyx_v_device_id = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":51
 * def _get_warpsize():
 *     device_id = runtime.getDevice()
 *     return runtime.getDeviceProperties(device_id)['warpSize']             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_13cupy_backends_4cuda_3api_7runtime_getDeviceProperties(__pyx_v_device_id, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_warpSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":48
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_warpsize():
 *     device_id = runtime.getDevice()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._get_warpsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":62
 * # Computed lazily (per device) so that importing CuPy does not require a
 * # functional ROCm/CUDA runtime.
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _full_mask():
 *     if runtime._is_hip_environment:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_full_mask(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_2_full_mask, "_full_mask()");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_3_full_mask = {"_full_mask", (PyCFunction)__pyx_pw_4cupy_5_core_7_kernel_3_full_mask, METH_NOARGS, __pyx_doc_4cupy_5_core_7_kernel_2_full_mask};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_full_mask(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_full_mask (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_2_full_mask(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_2_full_mask(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_full_mask", 0);

  /* "cupy/_core/_kernel.pyx":64
 * @_util.memoize(for_each_device=True)
 * def _full_mask():
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         return (1 << _get_warpsize()) - 1
 *     return 0xffffffff
*/
  if (__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment) {

    /* "cupy/_core/_kernel.pyx":65
 * def _full_mask():
 *     if runtime._is_hip_environment:
 *         return (1 << _get_warpsize()) - 1             # <<<<<<<<<<<<<<
 *     return 0xffffffff
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_warpsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_3 = PyNumber_Lshift(__pyx_mstate_global->__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":64
 * @_util.memoize(for_each_device=True)
 * def _full_mask():
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         return (1 << _get_warpsize()) - 1
 *     return 0xffffffff
*/
  }

  /* "cupy/_core/_kernel.pyx":66
 *     if runtime._is_hip_environment:
 *         return (1 << _get_warpsize()) - 1
 *     return 0xffffffff             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_4294967295);
  __pyx_r = __pyx_mstate_global->__pyx_int_4294967295;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":62
 * # Computed lazily (per device) so that importing CuPy does not require a
 * # functional ROCm/CUDA runtime.
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _full_mask():
 *     if runtime._is_hip_environment:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._full_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":71
 * # On HIP the mask *type* must be 64-bit (ROCm 7+ enforces via static_assert),
 * # so the C literal is suffixed with 'ULL'.
 * cpdef str _full_mask_hex():             # <<<<<<<<<<<<<<
 *     cdef str s = hex(_full_mask())
 *     if runtime._is_hip_environment:
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5_full_mask_hex(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel__full_mask_hex(CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_full_mask_hex", 0);

  /* "cupy/_core/_kernel.pyx":72
 * # so the C literal is suffixed with 'ULL'.
 * cpdef str _full_mask_hex():
 *     cdef str s = hex(_full_mask())             # <<<<<<<<<<<<<<
 *     if runtime._is_hip_environment:
 *         return s + 'ULL'
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_full_mask); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = __Pyx_PyNumber_Hex(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":73
 * cpdef str _full_mask_hex():
 *     cdef str s = hex(_full_mask())
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         return s + 'ULL'
 *     return s
*/
  if (__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment) {

    /* "cupy/_core/_kernel.pyx":74
 *     cdef str s = hex(_full_mask())
 *     if runtime._is_hip_environment:
 *         return s + 'ULL'             # <<<<<<<<<<<<<<
 *     return s
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_s, __pyx_mstate_global->__pyx_n_u_ULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":73
 * cpdef str _full_mask_hex():
 *     cdef str s = hex(_full_mask())
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         return s + 'ULL'
 *     return s
*/
  }

  /* "cupy/_core/_kernel.pyx":75
 *     if runtime._is_hip_environment:
 *         return s + 'ULL'
 *     return s             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_s);
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":71
 * # On HIP the mask *type* must be 64-bit (ROCm 7+ enforces via static_assert),
 * # so the C literal is suffixed with 'ULL'.
 * cpdef str _full_mask_hex():             # <<<<<<<<<<<<<<
 *     cdef str s = hex(_full_mask())
 *     if runtime._is_hip_environment:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._full_mask_hex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5_full_mask_hex(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_full_mask_hex, "_full_mask_hex() -> str");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5_full_mask_hex(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_full_mask_hex (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_full_mask_hex(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_full_mask_hex(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_full_mask_hex", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__full_mask_hex(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._full_mask_hex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":78
 * 
 * 
 * cdef str _get_simple_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         tuple params_, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop=''):
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code(PyObject *__pyx_v_params_, PyObject *__pyx_v_arginfos, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_preamble, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code *__pyx_optional_args) {
  PyObject *__pyx_v_loop_prep = ((PyObject*)__pyx_mstate_global->__pyx_kp_u__3);
  PyObject *__pyx_v_after_loop = ((PyObject*)__pyx_mstate_global->__pyx_kp_u__3);
  PyObject *__pyx_v_type_decls = NULL;
  PyObject *__pyx_v_params = NULL;
  PyObject *__pyx_v_typedef_preamble = NULL;
  PyObject *__pyx_v_module_code = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params __pyx_t_2;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_simple_elementwise_kernel_code", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_loop_prep = __pyx_optional_args->loop_prep;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_after_loop = __pyx_optional_args->after_loop;
      }
    }
  }

  /* "cupy/_core/_kernel.pyx":81
 *         tuple params_, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop=''):
 *     type_decls = set()             # <<<<<<<<<<<<<<
 *     params = _get_kernel_params(params_, arginfos, type_decls)
 *     typedef_preamble = type_map.get_typedef_code(type_decls)
*/
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_type_decls = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":82
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop=''):
 *     type_decls = set()
 *     params = _get_kernel_params(params_, arginfos, type_decls)             # <<<<<<<<<<<<<<
 *     typedef_preamble = type_map.get_typedef_code(type_decls)
 * 
*/
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.type_decls = __pyx_v_type_decls;
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__get_kernel_params(__pyx_v_params_, __pyx_v_arginfos, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":83
 *     type_decls = set()
 *     params = _get_kernel_params(params_, arginfos, type_decls)
 *     typedef_preamble = type_map.get_typedef_code(type_decls)             # <<<<<<<<<<<<<<
 * 
 *     # No loop unrolling due to avoid 64-bit division
*/
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.type_decls = __pyx_v_type_decls;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_type_map->__pyx_vtab)->get_typedef_code(__pyx_v_type_map, &__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_typedef_preamble = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":86
 * 
 *     # No loop unrolling due to avoid 64-bit division
 *     module_code = string.Template('''             # <<<<<<<<<<<<<<
 *     ${type_decls}${typedef_preamble}
 *     ${preamble}
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_string); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Template); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_9 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_type_decls_typedef_preamble_pre};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_4 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_4);

  /* "cupy/_core/_kernel.pyx":101
 *         typedef_preamble=typedef_preamble,
 *         params=params,
 *         type_decls=_scalar.format_type_decls(type_decls),             # <<<<<<<<<<<<<<
 *         operation=operation,
 *         name=name,
*/
  __pyx_t_8 = __pyx_f_4cupy_5_core_7_scalar_format_type_decls(__pyx_v_type_decls, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "cupy/_core/_kernel.pyx":106
 *         preamble=preamble,
 *         loop_prep=loop_prep,
 *         after_loop=after_loop)             # <<<<<<<<<<<<<<
 *     return module_code
 * 
*/
  __pyx_t_9 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 8 : 0)] = {__pyx_t_4, NULL};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_typedef_preamble, __pyx_v_typedef_preamble, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_params, __pyx_v_params, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_type_decls, __pyx_t_8, __pyx_t_6, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_operation, __pyx_v_operation, __pyx_t_6, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_v_name, __pyx_t_6, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_preamble, __pyx_v_preamble, __pyx_t_6, __pyx_callargs+1, 5) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_loop_prep, __pyx_v_loop_prep, __pyx_t_6, __pyx_callargs+1, 6) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_after_loop, __pyx_v_after_loop, __pyx_t_6, __pyx_callargs+1, 7) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_substitute, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_module_code = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":107
 *         loop_prep=loop_prep,
 *         after_loop=after_loop)
 *     return module_code             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_module_code;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 107, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":78
 * 
 * 
 * cdef str _get_simple_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         tuple params_, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop=''):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._get_simple_elementwise_kernel_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_type_decls);
  __Pyx_XDECREF(__pyx_v_params);
  __Pyx_XDECREF(__pyx_v_typedef_preamble);
  __Pyx_XDECREF(__pyx_v_module_code);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":110
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel_from_code(             # <<<<<<<<<<<<<<
 *         str name, str code, tuple options=()):
 *     module = compile_with_cache(code, options)
*/

static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code(PyObject *__pyx_v_name, PyObject *__pyx_v_code, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code *__pyx_optional_args) {

  /* "cupy/_core/_kernel.pyx":111
 * 
 * cdef function.Function _get_simple_elementwise_kernel_from_code(
 *         str name, str code, tuple options=()):             # <<<<<<<<<<<<<<
 *     module = compile_with_cache(code, options)
 *     return module.get_function(name)
*/
  PyObject *__pyx_v_options = ((PyObject*)__pyx_mstate_global->__pyx_empty_tuple);
  struct __pyx_obj_4cupy_4cuda_8function_Module *__pyx_v_module = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_4core_compile_with_cache __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_simple_elementwise_kernel_from_code", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_options = __pyx_optional_args->options;
    }
  }

  /* "cupy/_core/_kernel.pyx":112
 * cdef function.Function _get_simple_elementwise_kernel_from_code(
 *         str name, str code, tuple options=()):
 *     module = compile_with_cache(code, options)             # <<<<<<<<<<<<<<
 *     return module.get_function(name)
 * 
*/
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.options = __pyx_v_options;
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_4core_compile_with_cache(__pyx_v_code, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_module = ((struct __pyx_obj_4cupy_4cuda_8function_Module *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":113
 *         str name, str code, tuple options=()):
 *     module = compile_with_cache(code, options)
 *     return module.get_function(name)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_4cuda_8function_Module *)__pyx_v_module->__pyx_vtab)->get_function(__pyx_v_module, __pyx_v_name, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 113, __pyx_L1_error)
  __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":110
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel_from_code(             # <<<<<<<<<<<<<<
 *         str name, str code, tuple options=()):
 *     module = compile_with_cache(code, options)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._get_simple_elementwise_kernel_from_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_module);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":116
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel(             # <<<<<<<<<<<<<<
 *         tuple params, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop='',
*/

static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel(PyObject *__pyx_v_params, PyObject *__pyx_v_arginfos, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_preamble, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel *__pyx_optional_args) {
  PyObject *__pyx_v_loop_prep = ((PyObject*)__pyx_mstate_global->__pyx_kp_u__3);
  PyObject *__pyx_v_after_loop = ((PyObject*)__pyx_mstate_global->__pyx_kp_u__3);

  /* "cupy/_core/_kernel.pyx":119
 *         tuple params, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop='',
 *         tuple options=()):             # <<<<<<<<<<<<<<
 *     code = _get_simple_elementwise_kernel_code(
 *         params, arginfos, operation, name, type_map, preamble, loop_prep,
*/
  PyObject *__pyx_v_options = ((PyObject*)__pyx_mstate_global->__pyx_empty_tuple);
  PyObject *__pyx_v_code = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code __pyx_t_2;
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_simple_elementwise_kernel", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_loop_prep = __pyx_optional_args->loop_prep;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_after_loop = __pyx_optional_args->after_loop;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_options = __pyx_optional_args->options;
        }
      }
    }
  }

  /* "cupy/_core/_kernel.pyx":120
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop='',
 *         tuple options=()):
 *     code = _get_simple_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         params, arginfos, operation, name, type_map, preamble, loop_prep,
 *         after_loop
*/
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.loop_prep = __pyx_v_loop_prep;
  __pyx_t_2.after_loop = __pyx_v_after_loop;
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code(__pyx_v_params, __pyx_v_arginfos, __pyx_v_operation, __pyx_v_name, __pyx_v_type_map, __pyx_v_preamble, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_code = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":124
 *         after_loop
 *     )
 *     return _get_simple_elementwise_kernel_from_code(name, code, options)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.options = __pyx_v_options;
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code(__pyx_v_name, __pyx_v_code, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":116
 * 
 * 
 * cdef function.Function _get_simple_elementwise_kernel(             # <<<<<<<<<<<<<<
 *         tuple params, tuple arginfos, str operation, str name,
 *         _TypeMap type_map, str preamble, str loop_prep='', str after_loop='',
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._get_simple_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":127
 * 
 * 
 * @cython.profile(False)             # <<<<<<<<<<<<<<
 * cpdef inline _check_peer_access(_ndarray_base arr, int device_id):
 *     if arr.data.device_id == device_id:
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_7_check_peer_access(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_5_core_7_kernel__check_peer_access(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr, int __pyx_v_device_id, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_msg = NULL;
  int __pyx_v_peer_access;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4[5];
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_peer_access", 0);

  /* "cupy/_core/_kernel.pyx":129
 * @cython.profile(False)
 * cpdef inline _check_peer_access(_ndarray_base arr, int device_id):
 *     if arr.data.device_id == device_id:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_1 = (__pyx_v_arr->data->device_id == __pyx_v_device_id);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":130
 * cpdef inline _check_peer_access(_ndarray_base arr, int device_id):
 *     if arr.data.device_id == device_id:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     msg = (
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":129
 * @cython.profile(False)
 * cpdef inline _check_peer_access(_ndarray_base arr, int device_id):
 *     if arr.data.device_id == device_id:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":133
 * 
 *     msg = (
 *         f'The device where the array resides ({arr.data.device_id}) is '             # <<<<<<<<<<<<<<
 *         f'different from the current device ({device_id}).'
 *     )
*/
  __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_arr->data->device_id, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":134
 *     msg = (
 *         f'The device where the array resides ({arr.data.device_id}) is '
 *         f'different from the current device ({device_id}).'             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_device_id, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_The_device_where_the_array_resid;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_is_different_from_the_current_d;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_;

  /* "cupy/_core/_kernel.pyx":133
 * 
 *     msg = (
 *         f'The device where the array resides ({arr.data.device_id}) is '             # <<<<<<<<<<<<<<
 *         f'different from the current device ({device_id}).'
 *     )
*/
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 36 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 40 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127);
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_msg = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":137
 *     )
 * 
 *     cdef bint peer_access = device._enable_peer_access(             # <<<<<<<<<<<<<<
 *         device_id, arr.data.device_id)
 *     if not peer_access:
*/
  __pyx_t_1 = __pyx_f_4cupy_4cuda_6device__enable_peer_access(__pyx_v_device_id, __pyx_v_arr->data->device_id); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 137, __pyx_L1_error)
  __pyx_v_peer_access = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":139
 *     cdef bint peer_access = device._enable_peer_access(
 *         device_id, arr.data.device_id)
 *     if not peer_access:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             f'{msg} Peer access is unavailable between these devices.')
*/
  __pyx_t_1 = (!__pyx_v_peer_access);
  if (unlikely(__pyx_t_1)) {

    /* "cupy/_core/_kernel.pyx":140
 *         device_id, arr.data.device_id)
 *     if not peer_access:
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             f'{msg} Peer access is unavailable between these devices.')
 *     warnings.warn(
*/
    __pyx_t_3 = NULL;

    /* "cupy/_core/_kernel.pyx":141
 *     if not peer_access:
 *         raise ValueError(
 *             f'{msg} Peer access is unavailable between these devices.')             # <<<<<<<<<<<<<<
 *     warnings.warn(
 *         f'{msg} Peer access has been activated automatically.',
*/
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_Peer_access_is_unavailable_betw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 140, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":139
 *     cdef bint peer_access = device._enable_peer_access(
 *         device_id, arr.data.device_id)
 *     if not peer_access:             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             f'{msg} Peer access is unavailable between these devices.')
*/
  }

  /* "cupy/_core/_kernel.pyx":142
 *         raise ValueError(
 *             f'{msg} Peer access is unavailable between these devices.')
 *     warnings.warn(             # <<<<<<<<<<<<<<
 *         f'{msg} Peer access has been activated automatically.',
 *         _util.PerformanceWarning)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":143
 *             f'{msg} Peer access is unavailable between these devices.')
 *     warnings.warn(
 *         f'{msg} Peer access has been activated automatically.',             # <<<<<<<<<<<<<<
 *         _util.PerformanceWarning)
 * 
*/
  __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_Peer_access_has_been_activated); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cupy/_core/_kernel.pyx":144
 *     warnings.warn(
 *         f'{msg} Peer access has been activated automatically.',
 *         _util.PerformanceWarning)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_PerformanceWarning); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_9};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":127
 * 
 * 
 * @cython.profile(False)             # <<<<<<<<<<<<<<
 * cpdef inline _check_peer_access(_ndarray_base arr, int device_id):
 *     if arr.data.device_id == device_id:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cupy._core._kernel._check_peer_access", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_7_check_peer_access(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_6_check_peer_access, "_check_peer_access(_ndarray_base arr, int device_id)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_7_check_peer_access(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr = 0;
  int __pyx_v_device_id;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_check_peer_access (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arr,&__pyx_mstate_global->__pyx_n_u_device_id,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 127, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 127, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_check_peer_access", 0) < (0)) __PYX_ERR(0, 127, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_check_peer_access", 1, 2, 2, i); __PYX_ERR(0, 127, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 127, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 127, __pyx_L3_error)
    }
    __pyx_v_arr = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)values[0]);
    __pyx_v_device_id = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_device_id == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_check_peer_access", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 127, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._check_peer_access", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base, 1, "arr", 0))) __PYX_ERR(0, 128, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_6_check_peer_access(__pyx_self, __pyx_v_arr, __pyx_v_device_id);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_6_check_peer_access(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr, int __pyx_v_device_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_peer_access", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__check_peer_access(__pyx_v_arr, __pyx_v_device_id, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._check_peer_access", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":147
 * 
 * 
 * cdef inline _preprocess_arg(int dev_id, arg):             # <<<<<<<<<<<<<<
 *     s = _convert_from_cupy_like(arg, error=False)
 *     if s is not None:
*/

static CYTHON_INLINE PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_arg(int __pyx_v_dev_id, PyObject *__pyx_v_arg) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_preprocess_arg", 0);

  /* "cupy/_core/_kernel.pyx":148
 * 
 * cdef inline _preprocess_arg(int dev_id, arg):
 *     s = _convert_from_cupy_like(arg, error=False)             # <<<<<<<<<<<<<<
 *     if s is not None:
 *         _check_peer_access(<_ndarray_base>s, dev_id)
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_4core__convert_from_cupy_like(__pyx_v_arg, Py_False)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":149
 * cdef inline _preprocess_arg(int dev_id, arg):
 *     s = _convert_from_cupy_like(arg, error=False)
 *     if s is not None:             # <<<<<<<<<<<<<<
 *         _check_peer_access(<_ndarray_base>s, dev_id)
 *     elif isinstance(arg, texture.TextureObject):
*/
  __pyx_t_2 = (__pyx_v_s != Py_None);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":150
 *     s = _convert_from_cupy_like(arg, error=False)
 *     if s is not None:
 *         _check_peer_access(<_ndarray_base>s, dev_id)             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, texture.TextureObject):
 *         s = arg
*/
    __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__check_peer_access(((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_v_s), __pyx_v_dev_id, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":149
 * cdef inline _preprocess_arg(int dev_id, arg):
 *     s = _convert_from_cupy_like(arg, error=False)
 *     if s is not None:             # <<<<<<<<<<<<<<
 *         _check_peer_access(<_ndarray_base>s, dev_id)
 *     elif isinstance(arg, texture.TextureObject):
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":151
 *     if s is not None:
 *         _check_peer_access(<_ndarray_base>s, dev_id)
 *     elif isinstance(arg, texture.TextureObject):             # <<<<<<<<<<<<<<
 *         s = arg
 *     else:  # scalars or invalid args
*/
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_7texture_TextureObject); 
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":152
 *         _check_peer_access(<_ndarray_base>s, dev_id)
 *     elif isinstance(arg, texture.TextureObject):
 *         s = arg             # <<<<<<<<<<<<<<
 *     else:  # scalars or invalid args
 *         s = _scalar.CScalar(arg)
*/
    __Pyx_INCREF(__pyx_v_arg);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_v_arg);

    /* "cupy/_core/_kernel.pyx":151
 *     if s is not None:
 *         _check_peer_access(<_ndarray_base>s, dev_id)
 *     elif isinstance(arg, texture.TextureObject):             # <<<<<<<<<<<<<<
 *         s = arg
 *     else:  # scalars or invalid args
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":154
 *         s = arg
 *     else:  # scalars or invalid args
 *         s = _scalar.CScalar(arg)             # <<<<<<<<<<<<<<
 * 
 *     return s
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_arg};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_s, ((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":156
 *         s = _scalar.CScalar(arg)
 * 
 *     return s             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_s);
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":147
 * 
 * 
 * cdef inline _preprocess_arg(int dev_id, arg):             # <<<<<<<<<<<<<<
 *     s = _convert_from_cupy_like(arg, error=False)
 *     if s is not None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._preprocess_arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":159
 * 
 * 
 * cdef list _preprocess_args(int dev_id, args):             # <<<<<<<<<<<<<<
 *     """Preprocesses arguments for kernel invocation
 * 
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_args(int __pyx_v_dev_id, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_ret = 0;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_p_arg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_preprocess_args", 0);

  /* "cupy/_core/_kernel.pyx":165
 *     - Wraps Python/NumPy scalars into CScalars for easier processing.
 *     """
 *     cdef list ret = []             # <<<<<<<<<<<<<<
 *     for arg in args:
 *         p_arg = _preprocess_arg(dev_id, arg)
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":166
 *     """
 *     cdef list ret = []
 *     for arg in args:             # <<<<<<<<<<<<<<
 *         p_arg = _preprocess_arg(dev_id, arg)
 *         ret.append(p_arg)
*/
  if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
    __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 166, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 166, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 166, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":167
 *     cdef list ret = []
 *     for arg in args:
 *         p_arg = _preprocess_arg(dev_id, arg)             # <<<<<<<<<<<<<<
 *         ret.append(p_arg)
 *     return ret
*/
    __pyx_t_4 = __pyx_f_4cupy_5_core_7_kernel__preprocess_arg(__pyx_v_dev_id, __pyx_v_arg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_p_arg, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":168
 *     for arg in args:
 *         p_arg = _preprocess_arg(dev_id, arg)
 *         ret.append(p_arg)             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_p_arg); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 168, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":166
 *     """
 *     cdef list ret = []
 *     for arg in args:             # <<<<<<<<<<<<<<
 *         p_arg = _preprocess_arg(dev_id, arg)
 *         ret.append(p_arg)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":169
 *         p_arg = _preprocess_arg(dev_id, arg)
 *         ret.append(p_arg)
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":159
 * 
 * 
 * cdef list _preprocess_args(int dev_id, args):             # <<<<<<<<<<<<<<
 *     """Preprocesses arguments for kernel invocation
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._preprocess_args", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_p_arg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":172
 * 
 * 
 * cdef list _preprocess_optional_args(int dev_id, args):             # <<<<<<<<<<<<<<
 *     """Preprocesses arguments for kernel invocation
 * 
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__preprocess_optional_args(int __pyx_v_dev_id, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_ret = 0;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_preprocess_optional_args", 0);

  /* "cupy/_core/_kernel.pyx":180
 *       - If use_c_scalar is False, into NumPy scalars.
 *     """
 *     cdef list ret = []             # <<<<<<<<<<<<<<
 *     for arg in args:
 *         if arg is None:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":181
 *     """
 *     cdef list ret = []
 *     for arg in args:             # <<<<<<<<<<<<<<
 *         if arg is None:
 *             ret.append(None)
*/
  if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
    __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 181, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 181, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 181, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":182
 *     cdef list ret = []
 *     for arg in args:
 *         if arg is None:             # <<<<<<<<<<<<<<
 *             ret.append(None)
 *         else:
*/
    __pyx_t_5 = (__pyx_v_arg == Py_None);
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":183
 *     for arg in args:
 *         if arg is None:
 *             ret.append(None)             # <<<<<<<<<<<<<<
 *         else:
 *             ret.append(_preprocess_arg(dev_id, arg))
*/
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_ret, Py_None); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 183, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":182
 *     cdef list ret = []
 *     for arg in args:
 *         if arg is None:             # <<<<<<<<<<<<<<
 *             ret.append(None)
 *         else:
*/
      goto __pyx_L5;
    }

    /* "cupy/_core/_kernel.pyx":185
 *             ret.append(None)
 *         else:
 *             ret.append(_preprocess_arg(dev_id, arg))             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
    /*else*/ {
      __pyx_t_4 = __pyx_f_4cupy_5_core_7_kernel__preprocess_arg(__pyx_v_dev_id, __pyx_v_arg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 185, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L5:;

    /* "cupy/_core/_kernel.pyx":181
 *     """
 *     cdef list ret = []
 *     for arg in args:             # <<<<<<<<<<<<<<
 *         if arg is None:
 *             ret.append(None)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":186
 *         else:
 *             ret.append(_preprocess_arg(dev_id, arg))
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":172
 * 
 * 
 * cdef list _preprocess_optional_args(int dev_id, args):             # <<<<<<<<<<<<<<
 *     """Preprocesses arguments for kernel invocation
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._preprocess_optional_args", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":193
 *     # This class is immutable and used as a part of hash keys.
 * 
 *     def __init__(self, *args):             # <<<<<<<<<<<<<<
 *         arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits = args
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__init__", __pyx_kwds); return -1;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo___init__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo___init__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_arg_kind = NULL;
  PyObject *__pyx_v_typ = NULL;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_ndim = NULL;
  PyObject *__pyx_v_c_contiguous = NULL;
  PyObject *__pyx_v_index_32_bits = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":194
 * 
 *     def __init__(self, *args):
 *         arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits = args             # <<<<<<<<<<<<<<
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)
 * 
*/
  if (1) {
    PyObject* sequence = __pyx_v_args;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 194, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
      for (i=0; i < 6; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 194, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  }
  __pyx_v_arg_kind = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_typ = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_dtype = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_ndim = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_c_contiguous = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_index_32_bits = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":195
 *     def __init__(self, *args):
 *         arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits = args
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)             # <<<<<<<<<<<<<<
 * 
 *     cdef _ArgInfo _init(
*/
  __pyx_t_7 = ((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)__Pyx_PyLong_As_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_v_arg_kind)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_typ;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyType_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_6))) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_v_ndim); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_c_contiguous); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_index_32_bits); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self->__pyx_vtab)->_init(__pyx_v_self, __pyx_t_7, ((PyTypeObject*)__pyx_t_6), __pyx_v_dtype, __pyx_t_8, __pyx_t_9, __pyx_t_10)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":193
 *     # This class is immutable and used as a part of hash keys.
 * 
 *     def __init__(self, *args):             # <<<<<<<<<<<<<<
 *         arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits = args
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg_kind);
  __Pyx_XDECREF(__pyx_v_typ);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_ndim);
  __Pyx_XDECREF(__pyx_v_c_contiguous);
  __Pyx_XDECREF(__pyx_v_index_32_bits);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":197
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)
 * 
 *     cdef _ArgInfo _init(             # <<<<<<<<<<<<<<
 *             self,
 *             _ArgKind arg_kind,
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo__init(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __pyx_v_arg_kind, PyTypeObject *__pyx_v_typ, PyObject *__pyx_v_dtype, int __pyx_v_ndim, int __pyx_v_c_contiguous, int __pyx_v_index_32_bits) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init", 0);

  /* "cupy/_core/_kernel.pyx":205
 *             bint c_contiguous,
 *             bint index_32_bits):
 *         self.arg_kind = arg_kind             # <<<<<<<<<<<<<<
 *         self.type = typ
 *         self.dtype = dtype
*/
  __pyx_v_self->arg_kind = __pyx_v_arg_kind;

  /* "cupy/_core/_kernel.pyx":206
 *             bint index_32_bits):
 *         self.arg_kind = arg_kind
 *         self.type = typ             # <<<<<<<<<<<<<<
 *         self.dtype = dtype
 *         self.ndim = ndim
*/
  __Pyx_INCREF((PyObject *)__pyx_v_typ);
  __Pyx_GIVEREF((PyObject *)__pyx_v_typ);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->type);
  __Pyx_DECREF((PyObject *)__pyx_v_self->type);
  __pyx_v_self->type = __pyx_v_typ;

  /* "cupy/_core/_kernel.pyx":207
 *         self.arg_kind = arg_kind
 *         self.type = typ
 *         self.dtype = dtype             # <<<<<<<<<<<<<<
 *         self.ndim = ndim
 *         self.c_contiguous = c_contiguous
*/
  __Pyx_INCREF(__pyx_v_dtype);
  __Pyx_GIVEREF(__pyx_v_dtype);
  __Pyx_GOTREF(__pyx_v_self->dtype);
  __Pyx_DECREF(__pyx_v_self->dtype);
  __pyx_v_self->dtype = __pyx_v_dtype;

  /* "cupy/_core/_kernel.pyx":208
 *         self.type = typ
 *         self.dtype = dtype
 *         self.ndim = ndim             # <<<<<<<<<<<<<<
 *         self.c_contiguous = c_contiguous
 *         self.index_32_bits = index_32_bits
*/
  __pyx_v_self->ndim = __pyx_v_ndim;

  /* "cupy/_core/_kernel.pyx":209
 *         self.dtype = dtype
 *         self.ndim = ndim
 *         self.c_contiguous = c_contiguous             # <<<<<<<<<<<<<<
 *         self.index_32_bits = index_32_bits
 * 
*/
  __pyx_v_self->c_contiguous = __pyx_v_c_contiguous;

  /* "cupy/_core/_kernel.pyx":210
 *         self.ndim = ndim
 *         self.c_contiguous = c_contiguous
 *         self.index_32_bits = index_32_bits             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __pyx_v_self->index_32_bits = __pyx_v_index_32_bits;

  /* "cupy/_core/_kernel.pyx":197
 *         self._init(arg_kind, typ, dtype, ndim, c_contiguous, index_32_bits)
 * 
 *     cdef _ArgInfo _init(             # <<<<<<<<<<<<<<
 *             self,
 *             _ArgKind arg_kind,
*/

  /* function exit code */
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)Py_None); __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":212
 *         self.index_32_bits = index_32_bits
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_arg(object arg):
 *         typ = type(arg)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_arg(PyObject *__pyx_v_arg) {
  PyTypeObject *__pyx_v_typ = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_arg", 0);

  /* "cupy/_core/_kernel.pyx":214
 *     @staticmethod
 *     cdef _ArgInfo from_arg(object arg):
 *         typ = type(arg)             # <<<<<<<<<<<<<<
 *         if issubclass(typ, _ndarray_base):
 *             return _ArgInfo.from_ndarray(arg)
*/
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_arg)));
  __pyx_v_typ = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_arg)));

  /* "cupy/_core/_kernel.pyx":215
 *     cdef _ArgInfo from_arg(object arg):
 *         typ = type(arg)
 *         if issubclass(typ, _ndarray_base):             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_ndarray(arg)
 *         if typ is _scalar.CScalar:
*/
  __pyx_t_1 = PyObject_IsSubclass(((PyObject *)__pyx_v_typ), ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 215, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":216
 *         typ = type(arg)
 *         if issubclass(typ, _ndarray_base):
 *             return _ArgInfo.from_ndarray(arg)             # <<<<<<<<<<<<<<
 *         if typ is _scalar.CScalar:
 *             return _ArgInfo.from_scalar(arg)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 216, __pyx_L1_error)
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_ndarray(((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_v_arg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":215
 *     cdef _ArgInfo from_arg(object arg):
 *         typ = type(arg)
 *         if issubclass(typ, _ndarray_base):             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_ndarray(arg)
 *         if typ is _scalar.CScalar:
*/
  }

  /* "cupy/_core/_kernel.pyx":217
 *         if issubclass(typ, _ndarray_base):
 *             return _ArgInfo.from_ndarray(arg)
 *         if typ is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_scalar(arg)
 *         if typ is _carray.Indexer:
*/
  __pyx_t_1 = (__pyx_v_typ == __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":218
 *             return _ArgInfo.from_ndarray(arg)
 *         if typ is _scalar.CScalar:
 *             return _ArgInfo.from_scalar(arg)             # <<<<<<<<<<<<<<
 *         if typ is _carray.Indexer:
 *             return _ArgInfo.from_indexer(arg)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar))))) __PYX_ERR(0, 218, __pyx_L1_error)
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_scalar(((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_v_arg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":217
 *         if issubclass(typ, _ndarray_base):
 *             return _ArgInfo.from_ndarray(arg)
 *         if typ is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_scalar(arg)
 *         if typ is _carray.Indexer:
*/
  }

  /* "cupy/_core/_kernel.pyx":219
 *         if typ is _scalar.CScalar:
 *             return _ArgInfo.from_scalar(arg)
 *         if typ is _carray.Indexer:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_indexer(arg)
 *         if typ is memory.MemoryPointer:
*/
  __pyx_t_1 = (__pyx_v_typ == __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_carray_Indexer);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":220
 *             return _ArgInfo.from_scalar(arg)
 *         if typ is _carray.Indexer:
 *             return _ArgInfo.from_indexer(arg)             # <<<<<<<<<<<<<<
 *         if typ is memory.MemoryPointer:
 *             return _ArgInfo.from_memptr(arg)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_carray_Indexer))))) __PYX_ERR(0, 220, __pyx_L1_error)
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_indexer(((struct __pyx_obj_4cupy_5_core_7_carray_Indexer *)__pyx_v_arg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":219
 *         if typ is _scalar.CScalar:
 *             return _ArgInfo.from_scalar(arg)
 *         if typ is _carray.Indexer:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_indexer(arg)
 *         if typ is memory.MemoryPointer:
*/
  }

  /* "cupy/_core/_kernel.pyx":221
 *         if typ is _carray.Indexer:
 *             return _ArgInfo.from_indexer(arg)
 *         if typ is memory.MemoryPointer:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_memptr(arg)
 *         if typ is texture.TextureObject:
*/
  __pyx_t_1 = (__pyx_v_typ == __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":222
 *             return _ArgInfo.from_indexer(arg)
 *         if typ is memory.MemoryPointer:
 *             return _ArgInfo.from_memptr(arg)             # <<<<<<<<<<<<<<
 *         if typ is texture.TextureObject:
 *             return _ArgInfo.from_texture(arg)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer))))) __PYX_ERR(0, 222, __pyx_L1_error)
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_memptr(((struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *)__pyx_v_arg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":221
 *         if typ is _carray.Indexer:
 *             return _ArgInfo.from_indexer(arg)
 *         if typ is memory.MemoryPointer:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_memptr(arg)
 *         if typ is texture.TextureObject:
*/
  }

  /* "cupy/_core/_kernel.pyx":223
 *         if typ is memory.MemoryPointer:
 *             return _ArgInfo.from_memptr(arg)
 *         if typ is texture.TextureObject:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_texture(arg)
 *         assert False, typ
*/
  __pyx_t_1 = (__pyx_v_typ == __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_7texture_TextureObject);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":224
 *             return _ArgInfo.from_memptr(arg)
 *         if typ is texture.TextureObject:
 *             return _ArgInfo.from_texture(arg)             # <<<<<<<<<<<<<<
 *         assert False, typ
 * 
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_arg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arg, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_7texture_TextureObject))))) __PYX_ERR(0, 224, __pyx_L1_error)
    __pyx_t_2 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_texture(((struct __pyx_obj_4cupy_4cuda_7texture_TextureObject *)__pyx_v_arg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":223
 *         if typ is memory.MemoryPointer:
 *             return _ArgInfo.from_memptr(arg)
 *         if typ is texture.TextureObject:             # <<<<<<<<<<<<<<
 *             return _ArgInfo.from_texture(arg)
 *         assert False, typ
*/
  }

  /* "cupy/_core/_kernel.pyx":225
 *         if typ is texture.TextureObject:
 *             return _ArgInfo.from_texture(arg)
 *         assert False, typ             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(!0)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), ((PyObject *)__pyx_v_typ), 0, 0);
      __PYX_ERR(0, 225, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 225, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":212
 *         self.index_32_bits = index_32_bits
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_arg(object arg):
 *         typ = type(arg)
*/

  /* function exit code */
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_typ);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":227
 *         assert False, typ
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_ndarray(_ndarray_base arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_ndarray(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arg) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_ret = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_ndarray", 0);

  /* "cupy/_core/_kernel.pyx":229
 *     @staticmethod
 *     cdef _ArgInfo from_ndarray(_ndarray_base arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)             # <<<<<<<<<<<<<<
 *         ret._init(
 *             ARG_KIND_NDARRAY,
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":233
 *             ARG_KIND_NDARRAY,
 *             type(arg),
 *             arg.dtype,             # <<<<<<<<<<<<<<
 *             arg._shape.size(),
 *             arg._c_contiguous,
*/
  __pyx_t_1 = __pyx_v_arg->dtype;
  __Pyx_INCREF(__pyx_t_1);

  /* "cupy/_core/_kernel.pyx":230
 *     cdef _ArgInfo from_ndarray(_ndarray_base arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         ret._init(             # <<<<<<<<<<<<<<
 *             ARG_KIND_NDARRAY,
 *             type(arg),
*/
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_ret->__pyx_vtab)->_init(__pyx_v_ret, __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY, ((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_arg)))), __pyx_t_1, __pyx_v_arg->_shape.size(), __pyx_v_arg->_c_contiguous, __pyx_v_arg->_index_32_bits)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":237
 *             arg._c_contiguous,
 *             arg._index_32_bits)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":227
 *         assert False, typ
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_ndarray(_ndarray_base arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":239
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_scalar(_scalar.CScalar arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_scalar(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *__pyx_v_arg) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_ret = 0;
  PyArray_Descr *__pyx_v_dtype = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_scalar", 0);

  /* "cupy/_core/_kernel.pyx":241
 *     @staticmethod
 *     cdef _ArgInfo from_scalar(_scalar.CScalar arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)             # <<<<<<<<<<<<<<
 *         dtype = arg.descr
 *         ret._init(ARG_KIND_SCALAR, _scalar.CScalar, dtype, 0, True, True)
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":242
 *     cdef _ArgInfo from_scalar(_scalar.CScalar arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         dtype = arg.descr             # <<<<<<<<<<<<<<
 *         ret._init(ARG_KIND_SCALAR, _scalar.CScalar, dtype, 0, True, True)
 *         return ret
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_arg->descr);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dtype = ((PyArray_Descr *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":243
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         dtype = arg.descr
 *         ret._init(ARG_KIND_SCALAR, _scalar.CScalar, dtype, 0, True, True)             # <<<<<<<<<<<<<<
 *         return ret
 * 
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_ret->__pyx_vtab)->_init(__pyx_v_ret, __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_SCALAR, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar, ((PyObject *)__pyx_v_dtype), 0, 1, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":244
 *         dtype = arg.descr
 *         ret._init(ARG_KIND_SCALAR, _scalar.CScalar, dtype, 0, True, True)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":239
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_scalar(_scalar.CScalar arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XDECREF((PyObject *)__pyx_v_dtype);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":246
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_indexer(_carray.Indexer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_indexer(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *__pyx_v_arg) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_ret = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_indexer", 0);

  /* "cupy/_core/_kernel.pyx":248
 *     @staticmethod
 *     cdef _ArgInfo from_indexer(_carray.Indexer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)             # <<<<<<<<<<<<<<
 *         ret._init(
 *             ARG_KIND_INDEXER, _carray.Indexer, None, arg.ndim, True,
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":250
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         ret._init(
 *             ARG_KIND_INDEXER, _carray.Indexer, None, arg.ndim, True,             # <<<<<<<<<<<<<<
 *             arg._index_32_bits)
 *         return ret
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arg), __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":249
 *     cdef _ArgInfo from_indexer(_carray.Indexer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         ret._init(             # <<<<<<<<<<<<<<
 *             ARG_KIND_INDEXER, _carray.Indexer, None, arg.ndim, True,
 *             arg._index_32_bits)
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_ret->__pyx_vtab)->_init(__pyx_v_ret, __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_INDEXER, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_carray_Indexer, Py_None, __pyx_t_2, 1, __pyx_v_arg->_index_32_bits)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":252
 *             ARG_KIND_INDEXER, _carray.Indexer, None, arg.ndim, True,
 *             arg._index_32_bits)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":246
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_indexer(_carray.Indexer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":254
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_memptr(memory.MemoryPointer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_memptr(CYTHON_UNUSED struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *__pyx_v_arg) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_ret = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_memptr", 0);

  /* "cupy/_core/_kernel.pyx":256
 *     @staticmethod
 *     cdef _ArgInfo from_memptr(memory.MemoryPointer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)             # <<<<<<<<<<<<<<
 *         ret._init(
 *             ARG_KIND_POINTER, memory.MemoryPointer, None, 0, True, True)
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":257
 *     cdef _ArgInfo from_memptr(memory.MemoryPointer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         ret._init(             # <<<<<<<<<<<<<<
 *             ARG_KIND_POINTER, memory.MemoryPointer, None, 0, True, True)
 *         return ret
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_ret->__pyx_vtab)->_init(__pyx_v_ret, __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_POINTER, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer, Py_None, 0, 1, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":259
 *         ret._init(
 *             ARG_KIND_POINTER, memory.MemoryPointer, None, 0, True, True)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":254
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_memptr(memory.MemoryPointer arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_memptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":261
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_texture(texture.TextureObject arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_texture(CYTHON_UNUSED struct __pyx_obj_4cupy_4cuda_7texture_TextureObject *__pyx_v_arg) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_ret = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_texture", 0);

  /* "cupy/_core/_kernel.pyx":263
 *     @staticmethod
 *     cdef _ArgInfo from_texture(texture.TextureObject arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)             # <<<<<<<<<<<<<<
 *         ret._init(
 *             ARG_KIND_TEXTURE, texture.TextureObject, None, 0, True, True)
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":264
 *     cdef _ArgInfo from_texture(texture.TextureObject arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
 *         ret._init(             # <<<<<<<<<<<<<<
 *             ARG_KIND_TEXTURE, texture.TextureObject, None, 0, True, True)
 *         return ret
*/
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_ret->__pyx_vtab)->_init(__pyx_v_ret, __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_TEXTURE, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_7texture_TextureObject, Py_None, 0, 1, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":266
 *         ret._init(
 *             ARG_KIND_TEXTURE, texture.TextureObject, None, 0, True, True)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":261
 *         return ret
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo from_texture(texture.TextureObject arg):
 *         cdef _ArgInfo ret = _ArgInfo.__new__(_ArgInfo)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.from_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":268
 *         return ret
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash((self.arg_kind, self.type, self.dtype, self.ndim,
 *                      self.c_contiguous, self.index_32_bits))
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_3__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_3__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_2__hash__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_hash_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "cupy/_core/_kernel.pyx":269
 * 
 *     def __hash__(self):
 *         return hash((self.arg_kind, self.type, self.dtype, self.ndim,             # <<<<<<<<<<<<<<
 *                      self.c_contiguous, self.index_32_bits))
 * 
*/
  __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_v_self->arg_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":270
 *     def __hash__(self):
 *         return hash((self.arg_kind, self.type, self.dtype, self.ndim,
 *                      self.c_contiguous, self.index_32_bits))             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->c_contiguous); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->index_32_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cupy/_core/_kernel.pyx":269
 * 
 *     def __hash__(self):
 *         return hash((self.arg_kind, self.type, self.dtype, self.ndim,             # <<<<<<<<<<<<<<
 *                      self.c_contiguous, self.index_32_bits))
 * 
*/
  __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->type);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->type);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->type)) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __Pyx_GIVEREF(__pyx_v_self->dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->dtype) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_2) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_3) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_4) != (0)) __PYX_ERR(0, 269, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_6 = PyObject_Hash(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_hash_t)-1))) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":268
 *         return ret
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash((self.arg_kind, self.type, self.dtype, self.ndim,
 *                      self.c_contiguous, self.index_32_bits))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":272
 *                      self.c_contiguous, self.index_32_bits))
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef _ArgInfo oth
 *         if not isinstance(other, _ArgInfo):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4__eq__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_oth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "cupy/_core/_kernel.pyx":274
 *     def __eq__(self, other):
 *         cdef _ArgInfo oth
 *         if not isinstance(other, _ArgInfo):             # <<<<<<<<<<<<<<
 *             return False
 *         oth = other
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":275
 *         cdef _ArgInfo oth
 *         if not isinstance(other, _ArgInfo):
 *             return False             # <<<<<<<<<<<<<<
 *         oth = other
 *         return (
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":274
 *     def __eq__(self, other):
 *         cdef _ArgInfo oth
 *         if not isinstance(other, _ArgInfo):             # <<<<<<<<<<<<<<
 *             return False
 *         oth = other
*/
  }

  /* "cupy/_core/_kernel.pyx":276
 *         if not isinstance(other, _ArgInfo):
 *             return False
 *         oth = other             # <<<<<<<<<<<<<<
 *         return (
 *             self.arg_kind == oth.arg_kind
*/
  __pyx_t_3 = __pyx_v_other;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 276, __pyx_L1_error)
  __pyx_v_oth = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":277
 *             return False
 *         oth = other
 *         return (             # <<<<<<<<<<<<<<
 *             self.arg_kind == oth.arg_kind
 *             and self.type is oth.type
*/
  __Pyx_XDECREF(__pyx_r);

  /* "cupy/_core/_kernel.pyx":278
 *         oth = other
 *         return (
 *             self.arg_kind == oth.arg_kind             # <<<<<<<<<<<<<<
 *             and self.type is oth.type
 *             and self.dtype == oth.dtype
*/
  __pyx_t_2 = (__pyx_v_self->arg_kind == __pyx_v_oth->arg_kind);
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":279
 *         return (
 *             self.arg_kind == oth.arg_kind
 *             and self.type is oth.type             # <<<<<<<<<<<<<<
 *             and self.dtype == oth.dtype
 *             and self.ndim == oth.ndim
*/
  __pyx_t_2 = (__pyx_v_self->type == __pyx_v_oth->type);
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":280
 *             self.arg_kind == oth.arg_kind
 *             and self.type is oth.type
 *             and self.dtype == oth.dtype             # <<<<<<<<<<<<<<
 *             and self.ndim == oth.ndim
 *             and self.c_contiguous == oth.c_contiguous
*/
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->dtype, __pyx_v_oth->dtype, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 280, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":281
 *             and self.type is oth.type
 *             and self.dtype == oth.dtype
 *             and self.ndim == oth.ndim             # <<<<<<<<<<<<<<
 *             and self.c_contiguous == oth.c_contiguous
 *             and self.index_32_bits == oth.index_32_bits)
*/
  __pyx_t_2 = (__pyx_v_self->ndim == __pyx_v_oth->ndim);
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":282
 *             and self.dtype == oth.dtype
 *             and self.ndim == oth.ndim
 *             and self.c_contiguous == oth.c_contiguous             # <<<<<<<<<<<<<<
 *             and self.index_32_bits == oth.index_32_bits)
 * 
*/
  __pyx_t_2 = (__pyx_v_self->c_contiguous == __pyx_v_oth->c_contiguous);
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":283
 *             and self.ndim == oth.ndim
 *             and self.c_contiguous == oth.c_contiguous
 *             and self.index_32_bits == oth.index_32_bits)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_t_2 = (__pyx_v_self->index_32_bits == __pyx_v_oth->index_32_bits);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":272
 *                      self.c_contiguous, self.index_32_bits))
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef _ArgInfo oth
 *         if not isinstance(other, _ArgInfo):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_oth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":285
 *             and self.index_32_bits == oth.index_32_bits)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<_ArgInfo({})>'.format(
 *             ' '.join([
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_7__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_6__repr__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_6__repr__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cupy/_core/_kernel.pyx":286
 * 
 *     def __repr__(self):
 *         return '<_ArgInfo({})>'.format(             # <<<<<<<<<<<<<<
 *             ' '.join([
 *                 'arg_kind={!r}'.format(self.arg_kind),
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_ArgInfo;
  __Pyx_INCREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":288
 *         return '<_ArgInfo({})>'.format(
 *             ' '.join([
 *                 'arg_kind={!r}'.format(self.arg_kind),             # <<<<<<<<<<<<<<
 *                 'type={!r}'.format(self.type),
 *                 'dtype={!r}'.format(self.dtype),
*/
  __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u_arg_kind_r;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_v_self->arg_kind); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }

  /* "cupy/_core/_kernel.pyx":289
 *             ' '.join([
 *                 'arg_kind={!r}'.format(self.arg_kind),
 *                 'type={!r}'.format(self.type),             # <<<<<<<<<<<<<<
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ndim={!r}'.format(self.ndim),
*/
  __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u_type_r;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self->type)};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }

  /* "cupy/_core/_kernel.pyx":290
 *                 'arg_kind={!r}'.format(self.arg_kind),
 *                 'type={!r}'.format(self.type),
 *                 'dtype={!r}'.format(self.dtype),             # <<<<<<<<<<<<<<
 *                 'ndim={!r}'.format(self.ndim),
 *                 'c_contiguous={!r}'.format(self.c_contiguous),
*/
  __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u_dtype_r;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_self->dtype};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }

  /* "cupy/_core/_kernel.pyx":291
 *                 'type={!r}'.format(self.type),
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ndim={!r}'.format(self.ndim),             # <<<<<<<<<<<<<<
 *                 'c_contiguous={!r}'.format(self.c_contiguous),
 *                 'index_32_bits={!r}'.format(self.index_32_bits),
*/
  __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_ndim_r;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_self->ndim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9};
    __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }

  /* "cupy/_core/_kernel.pyx":292
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ndim={!r}'.format(self.ndim),
 *                 'c_contiguous={!r}'.format(self.c_contiguous),             # <<<<<<<<<<<<<<
 *                 'index_32_bits={!r}'.format(self.index_32_bits),
 *             ]))
*/
  __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_c_contiguous_r;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_v_self->c_contiguous); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_10};
    __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }

  /* "cupy/_core/_kernel.pyx":293
 *                 'ndim={!r}'.format(self.ndim),
 *                 'c_contiguous={!r}'.format(self.c_contiguous),
 *                 'index_32_bits={!r}'.format(self.index_32_bits),             # <<<<<<<<<<<<<<
 *             ]))
 * 
*/
  __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_index_32_bits_r;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_11 = __Pyx_PyBool_FromLong(__pyx_v_self->index_32_bits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_11};
    __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  }

  /* "cupy/_core/_kernel.pyx":287
 *     def __repr__(self):
 *         return '<_ArgInfo({})>'.format(
 *             ' '.join([             # <<<<<<<<<<<<<<
 *                 'arg_kind={!r}'.format(self.arg_kind),
 *                 'type={!r}'.format(self.type),
*/
  __pyx_t_11 = PyList_New(6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_7) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 4, __pyx_t_9) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_10);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_11, 5, __pyx_t_10) != (0)) __PYX_ERR(0, 287, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__4, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_10};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":285
 *             and self.index_32_bits == oth.index_32_bits)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<_ArgInfo({})>'.format(
 *             ' '.join([
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":296
 *             ]))
 * 
 *     cdef _ArgInfo as_ndarray_with_ndim(self, int ndim):             # <<<<<<<<<<<<<<
 *         # Returns an ndarray _ArgInfo with altered ndim.
 *         # If ndim is the same, self is returned untouched.
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_as_ndarray_with_ndim(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, int __pyx_v_ndim) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("as_ndarray_with_ndim", 0);

  /* "cupy/_core/_kernel.pyx":299
 *         # Returns an ndarray _ArgInfo with altered ndim.
 *         # If ndim is the same, self is returned untouched.
 *         assert self.arg_kind == ARG_KIND_NDARRAY             # <<<<<<<<<<<<<<
 *         if self.ndim == ndim:
 *             return self
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 299, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 299, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":300
 *         # If ndim is the same, self is returned untouched.
 *         assert self.arg_kind == ARG_KIND_NDARRAY
 *         if self.ndim == ndim:             # <<<<<<<<<<<<<<
 *             return self
 *         return _ArgInfo(
*/
  __pyx_t_1 = (__pyx_v_self->ndim == __pyx_v_ndim);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":301
 *         assert self.arg_kind == ARG_KIND_NDARRAY
 *         if self.ndim == ndim:
 *             return self             # <<<<<<<<<<<<<<
 *         return _ArgInfo(
 *             ARG_KIND_NDARRAY, self.dtype, self.dtype, ndim, False, False)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":300
 *         # If ndim is the same, self is returned untouched.
 *         assert self.arg_kind == ARG_KIND_NDARRAY
 *         if self.ndim == ndim:             # <<<<<<<<<<<<<<
 *             return self
 *         return _ArgInfo(
*/
  }

  /* "cupy/_core/_kernel.pyx":302
 *         if self.ndim == ndim:
 *             return self
 *         return _ArgInfo(             # <<<<<<<<<<<<<<
 *             ARG_KIND_NDARRAY, self.dtype, self.dtype, ndim, False, False)
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_3 = NULL;

  /* "cupy/_core/_kernel.pyx":303
 *             return self
 *         return _ArgInfo(
 *             ARG_KIND_NDARRAY, self.dtype, self.dtype, ndim, False, False)             # <<<<<<<<<<<<<<
 * 
 *     cdef bint is_ndarray(self) noexcept:
*/
  __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_t_4, __pyx_v_self->dtype, __pyx_v_self->dtype, __pyx_t_5, Py_False, Py_False};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo, __pyx_callargs+__pyx_t_6, (7-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":296
 *             ]))
 * 
 *     cdef _ArgInfo as_ndarray_with_ndim(self, int ndim):             # <<<<<<<<<<<<<<
 *         # Returns an ndarray _ArgInfo with altered ndim.
 *         # If ndim is the same, self is returned untouched.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.as_ndarray_with_ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":305
 *             ARG_KIND_NDARRAY, self.dtype, self.dtype, ndim, False, False)
 * 
 *     cdef bint is_ndarray(self) noexcept:             # <<<<<<<<<<<<<<
 *         return self.arg_kind == ARG_KIND_NDARRAY
 * 
*/

static int __pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_ndarray(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  int __pyx_r;

  /* "cupy/_core/_kernel.pyx":306
 * 
 *     cdef bint is_ndarray(self) noexcept:
 *         return self.arg_kind == ARG_KIND_NDARRAY             # <<<<<<<<<<<<<<
 * 
 *     cdef bint is_scalar(self) noexcept:
*/
  __pyx_r = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY);
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":305
 *             ARG_KIND_NDARRAY, self.dtype, self.dtype, ndim, False, False)
 * 
 *     cdef bint is_ndarray(self) noexcept:             # <<<<<<<<<<<<<<
 *         return self.arg_kind == ARG_KIND_NDARRAY
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":308
 *         return self.arg_kind == ARG_KIND_NDARRAY
 * 
 *     cdef bint is_scalar(self) noexcept:             # <<<<<<<<<<<<<<
 *         return self.arg_kind == ARG_KIND_SCALAR
 * 
*/

static int __pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_scalar(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  int __pyx_r;

  /* "cupy/_core/_kernel.pyx":309
 * 
 *     cdef bint is_scalar(self) noexcept:
 *         return self.arg_kind == ARG_KIND_SCALAR             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_c_type(self, type_decls=None):
*/
  __pyx_r = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_SCALAR);
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":308
 *         return self.arg_kind == ARG_KIND_NDARRAY
 * 
 *     cdef bint is_scalar(self) noexcept:             # <<<<<<<<<<<<<<
 *         return self.arg_kind == ARG_KIND_SCALAR
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":311
 *         return self.arg_kind == ARG_KIND_SCALAR
 * 
 *     cdef str get_c_type(self, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns the C type representation.
 *         if self.arg_kind == ARG_KIND_NDARRAY:
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type *__pyx_optional_args) {
  PyObject *__pyx_v_type_decls = ((PyObject *)Py_None);
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7[9];
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_type_decls = __pyx_optional_args->type_decls;
    }
  }

  /* "cupy/_core/_kernel.pyx":313
 *     cdef str get_c_type(self, type_decls=None):
 *         # Returns the C type representation.
 *         if self.arg_kind == ARG_KIND_NDARRAY:             # <<<<<<<<<<<<<<
 *             name = _get_typename(self.dtype, type_decls)
 *             name = 'CArray<%s, %d, %d, %d>' % (
*/
  __pyx_t_1 = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":314
 *         # Returns the C type representation.
 *         if self.arg_kind == ARG_KIND_NDARRAY:
 *             name = _get_typename(self.dtype, type_decls)             # <<<<<<<<<<<<<<
 *             name = 'CArray<%s, %d, %d, %d>' % (
 *                 name, self.ndim,
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_typename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_self->dtype, __pyx_v_type_decls};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":316
 *             name = _get_typename(self.dtype, type_decls)
 *             name = 'CArray<%s, %d, %d, %d>' % (
 *                 name, self.ndim,             # <<<<<<<<<<<<<<
 *                 self.c_contiguous, self.index_32_bits)
 *             return name
*/
    __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_self->ndim, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "cupy/_core/_kernel.pyx":317
 *             name = 'CArray<%s, %d, %d, %d>' % (
 *                 name, self.ndim,
 *                 self.c_contiguous, self.index_32_bits)             # <<<<<<<<<<<<<<
 *             return name
 *         if self.arg_kind == ARG_KIND_SCALAR:
*/
    __pyx_t_3 = __Pyx_PyUnicode_From_bint(__pyx_v_self->c_contiguous, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyUnicode_From_bint(__pyx_v_self->index_32_bits, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_CArray;
    __pyx_t_7[1] = __pyx_t_2;
    __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_7[3] = __pyx_t_4;
    __pyx_t_7[4] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_7[5] = __pyx_t_3;
    __pyx_t_7[6] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_7[7] = __pyx_t_6;
    __pyx_t_7[8] = __pyx_mstate_global->__pyx_kp_u__6;

    /* "cupy/_core/_kernel.pyx":315
 *         if self.arg_kind == ARG_KIND_NDARRAY:
 *             name = _get_typename(self.dtype, type_decls)
 *             name = 'CArray<%s, %d, %d, %d>' % (             # <<<<<<<<<<<<<<
 *                 name, self.ndim,
 *                 self.c_contiguous, self.index_32_bits)
*/
    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 9, 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "cupy/_core/_kernel.pyx":318
 *                 name, self.ndim,
 *                 self.c_contiguous, self.index_32_bits)
 *             return name             # <<<<<<<<<<<<<<
 *         if self.arg_kind == ARG_KIND_SCALAR:
 *             return _get_typename(self.dtype, type_decls)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __pyx_v_name;
    __Pyx_INCREF(__pyx_t_8);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_8)) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(0, 318, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_8);
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":313
 *     cdef str get_c_type(self, type_decls=None):
 *         # Returns the C type representation.
 *         if self.arg_kind == ARG_KIND_NDARRAY:             # <<<<<<<<<<<<<<
 *             name = _get_typename(self.dtype, type_decls)
 *             name = 'CArray<%s, %d, %d, %d>' % (
*/
  }

  /* "cupy/_core/_kernel.pyx":319
 *                 self.c_contiguous, self.index_32_bits)
 *             return name
 *         if self.arg_kind == ARG_KIND_SCALAR:             # <<<<<<<<<<<<<<
 *             return _get_typename(self.dtype, type_decls)
 *         if self.arg_kind == ARG_KIND_INDEXER:
*/
  __pyx_t_1 = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_SCALAR);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":320
 *             return name
 *         if self.arg_kind == ARG_KIND_SCALAR:
 *             return _get_typename(self.dtype, type_decls)             # <<<<<<<<<<<<<<
 *         if self.arg_kind == ARG_KIND_INDEXER:
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_typename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_self->dtype, __pyx_v_type_decls};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(0, 320, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_8);
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":319
 *                 self.c_contiguous, self.index_32_bits)
 *             return name
 *         if self.arg_kind == ARG_KIND_SCALAR:             # <<<<<<<<<<<<<<
 *             return _get_typename(self.dtype, type_decls)
 *         if self.arg_kind == ARG_KIND_INDEXER:
*/
  }

  /* "cupy/_core/_kernel.pyx":321
 *         if self.arg_kind == ARG_KIND_SCALAR:
 *             return _get_typename(self.dtype, type_decls)
 *         if self.arg_kind == ARG_KIND_INDEXER:             # <<<<<<<<<<<<<<
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
 *         if self.arg_kind == ARG_KIND_TEXTURE:
*/
  __pyx_t_1 = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_INDEXER);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":322
 *             return _get_typename(self.dtype, type_decls)
 *         if self.arg_kind == ARG_KIND_INDEXER:
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)             # <<<<<<<<<<<<<<
 *         if self.arg_kind == ARG_KIND_TEXTURE:
 *             return 'cudaTextureObject_t'
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_self->ndim, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyUnicode_From_bint(__pyx_v_self->index_32_bits, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_CIndexer;
    __pyx_t_9[1] = __pyx_t_8;
    __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_9[3] = __pyx_t_3;
    __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__6;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":321
 *         if self.arg_kind == ARG_KIND_SCALAR:
 *             return _get_typename(self.dtype, type_decls)
 *         if self.arg_kind == ARG_KIND_INDEXER:             # <<<<<<<<<<<<<<
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
 *         if self.arg_kind == ARG_KIND_TEXTURE:
*/
  }

  /* "cupy/_core/_kernel.pyx":323
 *         if self.arg_kind == ARG_KIND_INDEXER:
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
 *         if self.arg_kind == ARG_KIND_TEXTURE:             # <<<<<<<<<<<<<<
 *             return 'cudaTextureObject_t'
 *         assert False
*/
  __pyx_t_1 = (__pyx_v_self->arg_kind == __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_TEXTURE);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":324
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
 *         if self.arg_kind == ARG_KIND_TEXTURE:
 *             return 'cudaTextureObject_t'             # <<<<<<<<<<<<<<
 *         assert False
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cudaTextureObject_t);
    __pyx_r = __pyx_mstate_global->__pyx_n_u_cudaTextureObject_t;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":323
 *         if self.arg_kind == ARG_KIND_INDEXER:
 *             return 'CIndexer<%d, %d>' % (self.ndim, self.index_32_bits)
 *         if self.arg_kind == ARG_KIND_TEXTURE:             # <<<<<<<<<<<<<<
 *             return 'cudaTextureObject_t'
 *         assert False
*/
  }

  /* "cupy/_core/_kernel.pyx":325
 *         if self.arg_kind == ARG_KIND_TEXTURE:
 *             return 'cudaTextureObject_t'
 *         assert False             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_param_c_type(self, ParameterInfo p, type_decls=None):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(!0)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 325, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 325, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":311
 *         return self.arg_kind == ARG_KIND_SCALAR
 * 
 *     cdef str get_c_type(self, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns the C type representation.
 *         if self.arg_kind == ARG_KIND_NDARRAY:
*/

  /* function exit code */
  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":327
 *         assert False
 * 
 *     cdef str get_param_c_type(self, ParameterInfo p, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns the C type representation in the global function's
 *         # parameter list.
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type *__pyx_optional_args) {
  PyObject *__pyx_v_type_decls = ((PyObject *)Py_None);
  PyObject *__pyx_v_ctyp = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_param_c_type", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_type_decls = __pyx_optional_args->type_decls;
    }
  }

  /* "cupy/_core/_kernel.pyx":330
 *         # Returns the C type representation in the global function's
 *         # parameter list.
 *         cdef str ctyp = self.get_c_type(type_decls)             # <<<<<<<<<<<<<<
 *         if p.is_const:
 *             return 'const ' + ctyp
*/
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.type_decls = __pyx_v_type_decls;
  __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self->__pyx_vtab)->get_c_type(__pyx_v_self, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ctyp = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":331
 *         # parameter list.
 *         cdef str ctyp = self.get_c_type(type_decls)
 *         if p.is_const:             # <<<<<<<<<<<<<<
 *             return 'const ' + ctyp
 *         return ctyp
*/
  if (__pyx_v_p->is_const) {

    /* "cupy/_core/_kernel.pyx":332
 *         cdef str ctyp = self.get_c_type(type_decls)
 *         if p.is_const:
 *             return 'const ' + ctyp             # <<<<<<<<<<<<<<
 *         return ctyp
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyUnicode_ConcatSafe(__pyx_mstate_global->__pyx_kp_u_const, __pyx_v_ctyp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":331
 *         # parameter list.
 *         cdef str ctyp = self.get_c_type(type_decls)
 *         if p.is_const:             # <<<<<<<<<<<<<<
 *             return 'const ' + ctyp
 *         return ctyp
*/
  }

  /* "cupy/_core/_kernel.pyx":333
 *         if p.is_const:
 *             return 'const ' + ctyp
 *         return ctyp             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ctyp);
  __pyx_r = __pyx_v_ctyp;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":327
 *         assert False
 * 
 *     cdef str get_param_c_type(self, ParameterInfo p, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns the C type representation in the global function's
 *         # parameter list.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.get_param_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ctyp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":335
 *         return ctyp
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p):             # <<<<<<<<<<<<<<
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:
 *             return '_raw_' + p.name
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_var_name(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_var_name", 0);

  /* "cupy/_core/_kernel.pyx":336
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p):
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:             # <<<<<<<<<<<<<<
 *             return '_raw_' + p.name
 *         return p.name
*/
  switch (__pyx_v_self->arg_kind) {
    case __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_NDARRAY:
    case __pyx_e_4cupy_5_core_7_kernel_ARG_KIND_POINTER:
    __pyx_t_2 = 1;
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_t_3 = __pyx_t_2;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (!__pyx_v_p->raw);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":337
 *     cdef str get_c_var_name(self, ParameterInfo p):
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:
 *             return '_raw_' + p.name             # <<<<<<<<<<<<<<
 *         return p.name
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyUnicode_ConcatSafe(__pyx_mstate_global->__pyx_n_u_raw, __pyx_v_p->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":336
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p):
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:             # <<<<<<<<<<<<<<
 *             return '_raw_' + p.name
 *         return p.name
*/
  }

  /* "cupy/_core/_kernel.pyx":338
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:
 *             return '_raw_' + p.name
 *         return p.name             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_p->name);
  __pyx_r = __pyx_v_p->name;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":335
 *         return ctyp
 * 
 *     cdef str get_c_var_name(self, ParameterInfo p):             # <<<<<<<<<<<<<<
 *         if self.arg_kind in (ARG_KIND_NDARRAY, ARG_KIND_POINTER) and not p.raw:
 *             return '_raw_' + p.name
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.get_c_var_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":33
 * 
 *     cdef:
 *         readonly _ArgKind arg_kind             # <<<<<<<<<<<<<<
 *         readonly type type
 *         readonly object dtype
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_v_self->arg_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.arg_kind.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":34
 *     cdef:
 *         readonly _ArgKind arg_kind
 *         readonly type type             # <<<<<<<<<<<<<<
 *         readonly object dtype
 *         readonly int ndim
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4type_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4type___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4type___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->type);
  __pyx_r = ((PyObject *)__pyx_v_self->type);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":35
 *         readonly _ArgKind arg_kind
 *         readonly type type
 *         readonly object dtype             # <<<<<<<<<<<<<<
 *         readonly int ndim
 *         readonly bint c_contiguous
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5dtype_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5dtype_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_5dtype___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_5dtype___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __pyx_r = __pyx_v_self->dtype;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":36
 *         readonly type type
 *         readonly object dtype
 *         readonly int ndim             # <<<<<<<<<<<<<<
 *         readonly bint c_contiguous
 *         readonly bint index_32_bits
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4ndim_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4ndim___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_4ndim___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":37
 *         readonly object dtype
 *         readonly int ndim
 *         readonly bint c_contiguous             # <<<<<<<<<<<<<<
 *         readonly bint index_32_bits
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c_contiguous); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.c_contiguous.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":38
 *         readonly int ndim
 *         readonly bint c_contiguous
 *         readonly bint index_32_bits             # <<<<<<<<<<<<<<
 * 
 *     cdef _ArgInfo _init(
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits___get__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->index_32_bits); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.index_32_bits.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_8_ArgInfo_8__reduce_cython__, "_ArgInfo.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.arg_kind, self.c_contiguous, self.dtype, self.index_32_bits, self.ndim, self.type)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_v_self->arg_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->c_contiguous); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->index_32_bits); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_self->ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __Pyx_GIVEREF(__pyx_v_self->dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_self->dtype) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->type);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->type);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_v_self->type)) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.arg_kind, self.c_contiguous, self.dtype, self.index_32_bits, self.ndim, self.type)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v__dict = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "(tree fragment)":7
 *     state = (self.arg_kind, self.c_contiguous, self.dtype, self.index_32_bits, self.ndim, self.type)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_7 = (__pyx_v__dict != Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.dtype is not None or self.type is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.arg_kind, self.c_contiguous, self.dtype, self.index_32_bits, self.ndim, self.type)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.dtype is not None or self.type is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, None), state
*/
  /*else*/ {
    __pyx_t_7 = (__pyx_v_self->dtype != Py_None);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (__pyx_v_self->type != ((PyTypeObject*)Py_None));
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_6;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.dtype is not None or self.type is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.dtype is not None or self.type is not None
 *     if use_setstate:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__ArgInfo); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_216642581);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_216642581);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_mstate_global->__pyx_int_216642581) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.dtype is not None or self.type is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, None), state
 *     else:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ArgInfo__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__ArgInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_216642581);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_216642581);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_mstate_global->__pyx_int_216642581) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ArgInfo__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_8_ArgInfo_10__setstate_cython__, "_ArgInfo.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_10__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_ArgInfo_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__ArgInfo__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__ArgInfo__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__ArgInfo, (type(self), 0xce9b415, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__ArgInfo__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._ArgInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":341
 * 
 * 
 * cdef tuple _get_arginfos(list args):             # <<<<<<<<<<<<<<
 *     return tuple([_ArgInfo.from_arg(a) for a in args])
 * 
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_arginfos(PyObject *__pyx_v_args) {
  PyObject *__pyx_7genexpr__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_arginfos", 0);

  /* "cupy/_core/_kernel.pyx":342
 * 
 * cdef tuple _get_arginfos(list args):
 *     return tuple([_ArgInfo.from_arg(a) for a in args])             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 342, __pyx_L5_error)
    }
    __pyx_t_2 = __pyx_v_args; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 342, __pyx_L5_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_a, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_arg(__pyx_7genexpr__pyx_v_a)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 342, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_a); __pyx_7genexpr__pyx_v_a = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_a); __pyx_7genexpr__pyx_v_a = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":341
 * 
 * 
 * cdef tuple _get_arginfos(list args):             # <<<<<<<<<<<<<<
 *     return tuple([_ArgInfo.from_arg(a) for a in args])
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._get_arginfos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":345
 * 
 * 
 * cdef str _get_kernel_params(tuple params, tuple arginfos, type_decls=None):             # <<<<<<<<<<<<<<
 *     cdef ParameterInfo p
 *     cdef _ArgInfo arginfo
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_kernel_params(PyObject *__pyx_v_params, PyObject *__pyx_v_arginfos, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params *__pyx_optional_args) {
  PyObject *__pyx_v_type_decls = ((PyObject *)Py_None);
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_arginfo = 0;
  PyObject *__pyx_v_lst = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_kernel_params", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_type_decls = __pyx_optional_args->type_decls;
    }
  }

  /* "cupy/_core/_kernel.pyx":348
 *     cdef ParameterInfo p
 *     cdef _ArgInfo arginfo
 *     cdef lst = []             # <<<<<<<<<<<<<<
 *     assert len(params) == len(arginfos)
 * 
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lst = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":349
 *     cdef _ArgInfo arginfo
 *     cdef lst = []
 *     assert len(params) == len(arginfos)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(params)):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(__pyx_v_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 349, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_params); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 349, __pyx_L1_error)
    if (unlikely(__pyx_v_arginfos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 349, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v_arginfos); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 349, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_2 == __pyx_t_3);
    if (unlikely(!__pyx_t_4)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 349, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 349, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":351
 *     assert len(params) == len(arginfos)
 * 
 *     for i in range(len(params)):             # <<<<<<<<<<<<<<
 *         p = params[i]
 *         arginfo = arginfos[i]
*/
  if (unlikely(__pyx_v_params == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 351, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v_params); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 351, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "cupy/_core/_kernel.pyx":352
 * 
 *     for i in range(len(params)):
 *         p = params[i]             # <<<<<<<<<<<<<<
 *         arginfo = arginfos[i]
 *         arg = arginfo.get_param_c_type(p, type_decls)
*/
    if (unlikely(__pyx_v_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 352, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_params, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":353
 *     for i in range(len(params)):
 *         p = params[i]
 *         arginfo = arginfos[i]             # <<<<<<<<<<<<<<
 *         arg = arginfo.get_param_c_type(p, type_decls)
 *         lst.append('{} {}'.format(arg, arginfo.get_c_var_name(p)))
*/
    if (unlikely(__pyx_v_arginfos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 353, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_arginfos, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 353, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arginfo, ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":354
 *         p = params[i]
 *         arginfo = arginfos[i]
 *         arg = arginfo.get_param_c_type(p, type_decls)             # <<<<<<<<<<<<<<
 *         lst.append('{} {}'.format(arg, arginfo.get_c_var_name(p)))
 * 
*/
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.type_decls = __pyx_v_type_decls;
    __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->get_param_c_type(__pyx_v_arginfo, __pyx_v_p, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_arg, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":355
 *         arginfo = arginfos[i]
 *         arg = arginfo.get_param_c_type(p, type_decls)
 *         lst.append('{} {}'.format(arg, arginfo.get_c_var_name(p)))             # <<<<<<<<<<<<<<
 * 
 *     return ', '.join(lst)
*/
    __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u__7;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->get_c_var_name(__pyx_v_arginfo, __pyx_v_p); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_arg, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_lst, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "cupy/_core/_kernel.pyx":357
 *         lst.append('{} {}'.format(arg, arginfo.get_c_var_name(p)))
 * 
 *     return ', '.join(lst)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__5, __pyx_v_lst); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":345
 * 
 * 
 * cdef str _get_kernel_params(tuple params, tuple arginfos, type_decls=None):             # <<<<<<<<<<<<<<
 *     cdef ParameterInfo p
 *     cdef _ArgInfo arginfo
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._get_kernel_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_arginfo);
  __Pyx_XDECREF(__pyx_v_lst);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":360
 * 
 * 
 * cdef shape_t _reduce_dims(list args, tuple params,             # <<<<<<<<<<<<<<
 *                           const shape_t& shape) except *:
 *     """ Remove contiguous stride to optimize CUDA kernel."""
*/

static __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_f_4cupy_5_core_7_kernel__reduce_dims(PyObject *__pyx_v_args, PyObject *__pyx_v_params, __pyx_t_4cupy_5_core_7_carray_shape_t const &__pyx_v_shape) {
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr = 0;
  PyObject *__pyx_v_a = NULL;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reduce_dims", 0);

  /* "cupy/_core/_kernel.pyx":365
 *     cdef _ndarray_base arr
 * 
 *     if shape.size() <= 1 or len(args) == 0:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  __pyx_t_2 = (__pyx_v_shape.size() <= 1);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  if (unlikely(__pyx_v_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 365, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 365, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_3 == 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":366
 * 
 *     if shape.size() <= 1 or len(args) == 0:
 *         return shape             # <<<<<<<<<<<<<<
 * 
 *     if len(args) == 1:  # fast path for reduction
*/
    __pyx_r = __pyx_v_shape;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":365
 *     cdef _ndarray_base arr
 * 
 *     if shape.size() <= 1 or len(args) == 0:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":368
 *         return shape
 * 
 *     if len(args) == 1:  # fast path for reduction             # <<<<<<<<<<<<<<
 *         a = args[0]
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):
*/
  if (unlikely(__pyx_v_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 368, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 368, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_3 == 1);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":369
 * 
 *     if len(args) == 1:  # fast path for reduction
 *         a = args[0]             # <<<<<<<<<<<<<<
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):
 *             return shape
*/
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 369, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_a = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":370
 *     if len(args) == 1:  # fast path for reduction
 *         a = args[0]
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             return shape
 *         arr = a
*/
    if (unlikely(__pyx_v_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 370, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_params, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_4)->raw;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __pyx_t_5 = (!__pyx_t_2);
    __pyx_t_1 = __pyx_t_5;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cupy/_core/_kernel.pyx":371
 *         a = args[0]
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):
 *             return shape             # <<<<<<<<<<<<<<
 *         arr = a
 *         arr = arr.reduced_view()
*/
      __pyx_r = __pyx_v_shape;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":370
 *     if len(args) == 1:  # fast path for reduction
 *         a = args[0]
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             return shape
 *         arr = a
*/
    }

    /* "cupy/_core/_kernel.pyx":372
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):
 *             return shape
 *         arr = a             # <<<<<<<<<<<<<<
 *         arr = arr.reduced_view()
 *         if arr is a:
*/
    __pyx_t_4 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 372, __pyx_L1_error)
    __pyx_v_arr = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":373
 *             return shape
 *         arr = a
 *         arr = arr.reduced_view()             # <<<<<<<<<<<<<<
 *         if arr is a:
 *             return shape
*/
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *)__pyx_v_arr->__pyx_vtab)->reduced_view(__pyx_v_arr, 0, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":374
 *         arr = a
 *         arr = arr.reduced_view()
 *         if arr is a:             # <<<<<<<<<<<<<<
 *             return shape
 *         else:
*/
    __pyx_t_1 = (((PyObject *)__pyx_v_arr) == __pyx_v_a);
    if (__pyx_t_1) {

      /* "cupy/_core/_kernel.pyx":375
 *         arr = arr.reduced_view()
 *         if arr is a:
 *             return shape             # <<<<<<<<<<<<<<
 *         else:
 *             args[0] = arr
*/
      __pyx_r = __pyx_v_shape;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":374
 *         arr = a
 *         arr = arr.reduced_view()
 *         if arr is a:             # <<<<<<<<<<<<<<
 *             return shape
 *         else:
*/
    }

    /* "cupy/_core/_kernel.pyx":377
 *             return shape
 *         else:
 *             args[0] = arr             # <<<<<<<<<<<<<<
 *             return arr._shape
 *     return _reduced_view_core(args, params, shape)
*/
    /*else*/ {
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 377, __pyx_L1_error)
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_args, 0, ((PyObject *)__pyx_v_arr), long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument) < 0))) __PYX_ERR(0, 377, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":378
 *         else:
 *             args[0] = arr
 *             return arr._shape             # <<<<<<<<<<<<<<
 *     return _reduced_view_core(args, params, shape)
 * 
*/
      __pyx_r = __pyx_v_arr->_shape;
      goto __pyx_L0;
    }

    /* "cupy/_core/_kernel.pyx":368
 *         return shape
 * 
 *     if len(args) == 1:  # fast path for reduction             # <<<<<<<<<<<<<<
 *         a = args[0]
 *         if (<ParameterInfo>params[0]).raw or not isinstance(a, _ndarray_base):
*/
  }

  /* "cupy/_core/_kernel.pyx":379
 *             args[0] = arr
 *             return arr._shape
 *     return _reduced_view_core(args, params, shape)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_6 = __pyx_f_4cupy_5_core_7_kernel__reduced_view_core(__pyx_v_args, __pyx_v_params, __pyx_v_shape); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error)
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":360
 * 
 * 
 * cdef shape_t _reduce_dims(list args, tuple params,             # <<<<<<<<<<<<<<
 *                           const shape_t& shape) except *:
 *     """ Remove contiguous stride to optimize CUDA kernel."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._reduce_dims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":382
 * 
 * 
 * cdef shape_t _reduced_view_core(             # <<<<<<<<<<<<<<
 *         list args, tuple params, const shape_t& shape) except *:
 *     cdef int i, ax, last_ax, ndim
*/

static __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_f_4cupy_5_core_7_kernel__reduced_view_core(PyObject *__pyx_v_args, PyObject *__pyx_v_params, __pyx_t_4cupy_5_core_7_carray_shape_t const &__pyx_v_shape) {
  int __pyx_v_i;
  int __pyx_v_ax;
  int __pyx_v_last_ax;
  int __pyx_v_ndim;
  Py_ssize_t __pyx_v_total_size;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_v_vecshape;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_v_newshape;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_v_newstrides;
  std::vector<int>  __pyx_v_array_indexes;
  std::vector<int>  __pyx_v_axes;
  std::vector<int>  __pyx_v_strides_indexes;
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p = 0;
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr = 0;
  PyObject *__pyx_v_a = NULL;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  std::vector<int> ::iterator __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  std::vector<int> ::iterator __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reduced_view_core", 0);

  /* "cupy/_core/_kernel.pyx":392
 *     cdef _ndarray_base arr
 * 
 *     ndim = shape.size()             # <<<<<<<<<<<<<<
 *     array_indexes.reserve(len(args))
 *     strides_indexes.reserve(len(args))
*/
  __pyx_v_ndim = __pyx_v_shape.size();

  /* "cupy/_core/_kernel.pyx":393
 * 
 *     ndim = shape.size()
 *     array_indexes.reserve(len(args))             # <<<<<<<<<<<<<<
 *     strides_indexes.reserve(len(args))
 *     for i in range(len(args)):
*/
  if (unlikely(__pyx_v_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 393, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 393, __pyx_L1_error)
  try {
    __pyx_v_array_indexes.reserve(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 393, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":394
 *     ndim = shape.size()
 *     array_indexes.reserve(len(args))
 *     strides_indexes.reserve(len(args))             # <<<<<<<<<<<<<<
 *     for i in range(len(args)):
 *         p = params[i]
*/
  if (unlikely(__pyx_v_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 394, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 394, __pyx_L1_error)
  try {
    __pyx_v_strides_indexes.reserve(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 394, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":395
 *     array_indexes.reserve(len(args))
 *     strides_indexes.reserve(len(args))
 *     for i in range(len(args)):             # <<<<<<<<<<<<<<
 *         p = params[i]
 *         if p.raw:
*/
  if (unlikely(__pyx_v_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 395, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 395, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "cupy/_core/_kernel.pyx":396
 *     strides_indexes.reserve(len(args))
 *     for i in range(len(args)):
 *         p = params[i]             # <<<<<<<<<<<<<<
 *         if p.raw:
 *             continue
*/
    if (unlikely(__pyx_v_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 396, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_params, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 396, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":397
 *     for i in range(len(args)):
 *         p = params[i]
 *         if p.raw:             # <<<<<<<<<<<<<<
 *             continue
 *         a = args[i]
*/
    if (__pyx_v_p->raw) {

      /* "cupy/_core/_kernel.pyx":398
 *         p = params[i]
 *         if p.raw:
 *             continue             # <<<<<<<<<<<<<<
 *         a = args[i]
 *         if isinstance(a, _ndarray_base):
*/
      goto __pyx_L3_continue;

      /* "cupy/_core/_kernel.pyx":397
 *     for i in range(len(args)):
 *         p = params[i]
 *         if p.raw:             # <<<<<<<<<<<<<<
 *             continue
 *         a = args[i]
*/
    }

    /* "cupy/_core/_kernel.pyx":399
 *         if p.raw:
 *             continue
 *         a = args[i]             # <<<<<<<<<<<<<<
 *         if isinstance(a, _ndarray_base):
 *             array_indexes.push_back(i)
*/
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 399, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":400
 *             continue
 *         a = args[i]
 *         if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             array_indexes.push_back(i)
 *             arr = a
*/
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":401
 *         a = args[i]
 *         if isinstance(a, _ndarray_base):
 *             array_indexes.push_back(i)             # <<<<<<<<<<<<<<
 *             arr = a
 *             if not arr._c_contiguous:
*/
      try {
        __pyx_v_array_indexes.push_back(__pyx_v_i);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 401, __pyx_L1_error)
      }

      /* "cupy/_core/_kernel.pyx":402
 *         if isinstance(a, _ndarray_base):
 *             array_indexes.push_back(i)
 *             arr = a             # <<<<<<<<<<<<<<
 *             if not arr._c_contiguous:
 *                 if ndim == 2:  # short cut
*/
      __pyx_t_4 = __pyx_v_a;
      __Pyx_INCREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 402, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":403
 *             array_indexes.push_back(i)
 *             arr = a
 *             if not arr._c_contiguous:             # <<<<<<<<<<<<<<
 *                 if ndim == 2:  # short cut
 *                     return shape
*/
      __pyx_t_5 = (!__pyx_v_arr->_c_contiguous);
      if (__pyx_t_5) {

        /* "cupy/_core/_kernel.pyx":404
 *             arr = a
 *             if not arr._c_contiguous:
 *                 if ndim == 2:  # short cut             # <<<<<<<<<<<<<<
 *                     return shape
 *                 strides_indexes.push_back(i)
*/
        __pyx_t_5 = (__pyx_v_ndim == 2);
        if (__pyx_t_5) {

          /* "cupy/_core/_kernel.pyx":405
 *             if not arr._c_contiguous:
 *                 if ndim == 2:  # short cut
 *                     return shape             # <<<<<<<<<<<<<<
 *                 strides_indexes.push_back(i)
 * 
*/
          __pyx_r = __pyx_v_shape;
          goto __pyx_L0;

          /* "cupy/_core/_kernel.pyx":404
 *             arr = a
 *             if not arr._c_contiguous:
 *                 if ndim == 2:  # short cut             # <<<<<<<<<<<<<<
 *                     return shape
 *                 strides_indexes.push_back(i)
*/
        }

        /* "cupy/_core/_kernel.pyx":406
 *                 if ndim == 2:  # short cut
 *                     return shape
 *                 strides_indexes.push_back(i)             # <<<<<<<<<<<<<<
 * 
 *     if array_indexes.size() == 0:
*/
        try {
          __pyx_v_strides_indexes.push_back(__pyx_v_i);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 406, __pyx_L1_error)
        }

        /* "cupy/_core/_kernel.pyx":403
 *             array_indexes.push_back(i)
 *             arr = a
 *             if not arr._c_contiguous:             # <<<<<<<<<<<<<<
 *                 if ndim == 2:  # short cut
 *                     return shape
*/
      }

      /* "cupy/_core/_kernel.pyx":400
 *             continue
 *         a = args[i]
 *         if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             array_indexes.push_back(i)
 *             arr = a
*/
    }
    __pyx_L3_continue:;
  }

  /* "cupy/_core/_kernel.pyx":408
 *                 strides_indexes.push_back(i)
 * 
 *     if array_indexes.size() == 0:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  __pyx_t_5 = (__pyx_v_array_indexes.size() == 0);
  if (__pyx_t_5) {

    /* "cupy/_core/_kernel.pyx":409
 * 
 *     if array_indexes.size() == 0:
 *         return shape             # <<<<<<<<<<<<<<
 * 
 *     if strides_indexes.size() == 0:
*/
    __pyx_r = __pyx_v_shape;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":408
 *                 strides_indexes.push_back(i)
 * 
 *     if array_indexes.size() == 0:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":411
 *         return shape
 * 
 *     if strides_indexes.size() == 0:             # <<<<<<<<<<<<<<
 *         # The input arrays are all c_contiguous
 *         i = array_indexes[0]
*/
  __pyx_t_5 = (__pyx_v_strides_indexes.size() == 0);
  if (__pyx_t_5) {

    /* "cupy/_core/_kernel.pyx":413
 *     if strides_indexes.size() == 0:
 *         # The input arrays are all c_contiguous
 *         i = array_indexes[0]             # <<<<<<<<<<<<<<
 *         arr = args[i]
 *         total_size = arr.size
*/
    __pyx_v_i = (__pyx_v_array_indexes[0]);

    /* "cupy/_core/_kernel.pyx":414
 *         # The input arrays are all c_contiguous
 *         i = array_indexes[0]
 *         arr = args[i]             # <<<<<<<<<<<<<<
 *         total_size = arr.size
 *         newshape.assign(<Py_ssize_t>1, total_size)
*/
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 414, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":415
 *         i = array_indexes[0]
 *         arr = args[i]
 *         total_size = arr.size             # <<<<<<<<<<<<<<
 *         newshape.assign(<Py_ssize_t>1, total_size)
 *         newstrides.resize(1)
*/
    __pyx_t_1 = __pyx_v_arr->size;
    __pyx_v_total_size = __pyx_t_1;

    /* "cupy/_core/_kernel.pyx":416
 *         arr = args[i]
 *         total_size = arr.size
 *         newshape.assign(<Py_ssize_t>1, total_size)             # <<<<<<<<<<<<<<
 *         newstrides.resize(1)
 *         for i in array_indexes:
*/
    try {
      __pyx_v_newshape.assign(((Py_ssize_t)1), __pyx_v_total_size);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 416, __pyx_L1_error)
    }

    /* "cupy/_core/_kernel.pyx":417
 *         total_size = arr.size
 *         newshape.assign(<Py_ssize_t>1, total_size)
 *         newstrides.resize(1)             # <<<<<<<<<<<<<<
 *         for i in array_indexes:
 *             arr = args[i]
*/
    try {
      __pyx_v_newstrides.resize(1);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 417, __pyx_L1_error)
    }

    /* "cupy/_core/_kernel.pyx":418
 *         newshape.assign(<Py_ssize_t>1, total_size)
 *         newstrides.resize(1)
 *         for i in array_indexes:             # <<<<<<<<<<<<<<
 *             arr = args[i]
 *             newstrides[0] = arr.dtype.itemsize
*/
    __pyx_t_6 = __pyx_v_array_indexes.begin();
    for (; __pyx_t_6 != __pyx_v_array_indexes.end(); ++__pyx_t_6) {
      __pyx_t_3 = *__pyx_t_6;
      __pyx_v_i = __pyx_t_3;

      /* "cupy/_core/_kernel.pyx":419
 *         newstrides.resize(1)
 *         for i in array_indexes:
 *             arr = args[i]             # <<<<<<<<<<<<<<
 *             newstrides[0] = arr.dtype.itemsize
 *             # TODO(niboshi): Confirm update_x_contiguity flags
*/
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 419, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 419, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":420
 *         for i in array_indexes:
 *             arr = args[i]
 *             newstrides[0] = arr.dtype.itemsize             # <<<<<<<<<<<<<<
 *             # TODO(niboshi): Confirm update_x_contiguity flags
 *             args[i] = arr._view(
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr->dtype, __pyx_mstate_global->__pyx_n_u_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      (__pyx_v_newstrides[0]) = __pyx_t_1;

      /* "cupy/_core/_kernel.pyx":422
 *             newstrides[0] = arr.dtype.itemsize
 *             # TODO(niboshi): Confirm update_x_contiguity flags
 *             args[i] = arr._view(             # <<<<<<<<<<<<<<
 *                 type(arr), newshape, newstrides, False, True, arr)
 *         return newshape
*/
      __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *)__pyx_v_arr->__pyx_vtab)->_view(__pyx_v_arr, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_arr))), __pyx_v_newshape, __pyx_v_newstrides, 0, 1, ((PyObject *)__pyx_v_arr))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 422, __pyx_L1_error)
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_args, __pyx_v_i, __pyx_t_4, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument) < 0))) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":418
 *         newshape.assign(<Py_ssize_t>1, total_size)
 *         newstrides.resize(1)
 *         for i in array_indexes:             # <<<<<<<<<<<<<<
 *             arr = args[i]
 *             newstrides[0] = arr.dtype.itemsize
*/
    }

    /* "cupy/_core/_kernel.pyx":424
 *             args[i] = arr._view(
 *                 type(arr), newshape, newstrides, False, True, arr)
 *         return newshape             # <<<<<<<<<<<<<<
 * 
 *     axes.reserve(ndim)
*/
    __pyx_r = __pyx_v_newshape;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":411
 *         return shape
 * 
 *     if strides_indexes.size() == 0:             # <<<<<<<<<<<<<<
 *         # The input arrays are all c_contiguous
 *         i = array_indexes[0]
*/
  }

  /* "cupy/_core/_kernel.pyx":426
 *         return newshape
 * 
 *     axes.reserve(ndim)             # <<<<<<<<<<<<<<
 *     vecshape.reserve(ndim)
 *     for ax in range(ndim):
*/
  try {
    __pyx_v_axes.reserve(__pyx_v_ndim);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 426, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":427
 * 
 *     axes.reserve(ndim)
 *     vecshape.reserve(ndim)             # <<<<<<<<<<<<<<
 *     for ax in range(ndim):
 *         vecshape.push_back(shape[ax])
*/
  try {
    __pyx_v_vecshape.reserve(__pyx_v_ndim);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 427, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":428
 *     axes.reserve(ndim)
 *     vecshape.reserve(ndim)
 *     for ax in range(ndim):             # <<<<<<<<<<<<<<
 *         vecshape.push_back(shape[ax])
 *     last_ax = -1
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_7 = __pyx_t_3;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_ax = __pyx_t_8;

    /* "cupy/_core/_kernel.pyx":429
 *     vecshape.reserve(ndim)
 *     for ax in range(ndim):
 *         vecshape.push_back(shape[ax])             # <<<<<<<<<<<<<<
 *     last_ax = -1
 *     for ax in range(ndim):
*/
    try {
      __pyx_v_vecshape.push_back((__pyx_v_shape[__pyx_v_ax]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 429, __pyx_L1_error)
    }
  }

  /* "cupy/_core/_kernel.pyx":430
 *     for ax in range(ndim):
 *         vecshape.push_back(shape[ax])
 *     last_ax = -1             # <<<<<<<<<<<<<<
 *     for ax in range(ndim):
 *         if vecshape[ax] == 1:
*/
  __pyx_v_last_ax = -1;

  /* "cupy/_core/_kernel.pyx":431
 *         vecshape.push_back(shape[ax])
 *     last_ax = -1
 *     for ax in range(ndim):             # <<<<<<<<<<<<<<
 *         if vecshape[ax] == 1:
 *             continue
*/
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_7 = __pyx_t_3;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_ax = __pyx_t_8;

    /* "cupy/_core/_kernel.pyx":432
 *     last_ax = -1
 *     for ax in range(ndim):
 *         if vecshape[ax] == 1:             # <<<<<<<<<<<<<<
 *             continue
 *         if last_ax < 0:
*/
    __pyx_t_5 = ((__pyx_v_vecshape[__pyx_v_ax]) == 1);
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":433
 *     for ax in range(ndim):
 *         if vecshape[ax] == 1:
 *             continue             # <<<<<<<<<<<<<<
 *         if last_ax < 0:
 *             last_ax = ax
*/
      goto __pyx_L16_continue;

      /* "cupy/_core/_kernel.pyx":432
 *     last_ax = -1
 *     for ax in range(ndim):
 *         if vecshape[ax] == 1:             # <<<<<<<<<<<<<<
 *             continue
 *         if last_ax < 0:
*/
    }

    /* "cupy/_core/_kernel.pyx":434
 *         if vecshape[ax] == 1:
 *             continue
 *         if last_ax < 0:             # <<<<<<<<<<<<<<
 *             last_ax = ax
 *             continue
*/
    __pyx_t_5 = (__pyx_v_last_ax < 0);
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":435
 *             continue
 *         if last_ax < 0:
 *             last_ax = ax             # <<<<<<<<<<<<<<
 *             continue
 *         for i in strides_indexes:
*/
      __pyx_v_last_ax = __pyx_v_ax;

      /* "cupy/_core/_kernel.pyx":436
 *         if last_ax < 0:
 *             last_ax = ax
 *             continue             # <<<<<<<<<<<<<<
 *         for i in strides_indexes:
 *             arr = args[i]
*/
      goto __pyx_L16_continue;

      /* "cupy/_core/_kernel.pyx":434
 *         if vecshape[ax] == 1:
 *             continue
 *         if last_ax < 0:             # <<<<<<<<<<<<<<
 *             last_ax = ax
 *             continue
*/
    }

    /* "cupy/_core/_kernel.pyx":437
 *             last_ax = ax
 *             continue
 *         for i in strides_indexes:             # <<<<<<<<<<<<<<
 *             arr = args[i]
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:
*/
    __pyx_t_6 = __pyx_v_strides_indexes.begin();
    for (; __pyx_t_6 != __pyx_v_strides_indexes.end(); ++__pyx_t_6) {
      __pyx_t_9 = *__pyx_t_6;
      __pyx_v_i = __pyx_t_9;

      /* "cupy/_core/_kernel.pyx":438
 *             continue
 *         for i in strides_indexes:
 *             arr = args[i]             # <<<<<<<<<<<<<<
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:
 *                 axes.push_back(last_ax)
*/
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 438, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":439
 *         for i in strides_indexes:
 *             arr = args[i]
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:             # <<<<<<<<<<<<<<
 *                 axes.push_back(last_ax)
 *                 break
*/
      __pyx_t_5 = (((__pyx_v_arr->_strides[__pyx_v_ax]) * (__pyx_v_vecshape[__pyx_v_ax])) != (__pyx_v_arr->_strides[__pyx_v_last_ax]));
      if (__pyx_t_5) {

        /* "cupy/_core/_kernel.pyx":440
 *             arr = args[i]
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:
 *                 axes.push_back(last_ax)             # <<<<<<<<<<<<<<
 *                 break
 *         else:
*/
        try {
          __pyx_v_axes.push_back(__pyx_v_last_ax);
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 440, __pyx_L1_error)
        }

        /* "cupy/_core/_kernel.pyx":441
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:
 *                 axes.push_back(last_ax)
 *                 break             # <<<<<<<<<<<<<<
 *         else:
 *             vecshape[ax] *= vecshape[last_ax]
*/
        goto __pyx_L21_break;

        /* "cupy/_core/_kernel.pyx":439
 *         for i in strides_indexes:
 *             arr = args[i]
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:             # <<<<<<<<<<<<<<
 *                 axes.push_back(last_ax)
 *                 break
*/
      }

      /* "cupy/_core/_kernel.pyx":437
 *             last_ax = ax
 *             continue
 *         for i in strides_indexes:             # <<<<<<<<<<<<<<
 *             arr = args[i]
 *             if arr._strides[ax] * vecshape[ax] != arr._strides[last_ax]:
*/
    }
    goto __pyx_L23_for_else;
    __pyx_L21_break:;
    goto __pyx_L24_for_end;
    /*else*/ {
      __pyx_L23_for_else:;

      /* "cupy/_core/_kernel.pyx":443
 *                 break
 *         else:
 *             vecshape[ax] *= vecshape[last_ax]             # <<<<<<<<<<<<<<
 *         last_ax = ax
 *     if last_ax >= 0:
*/
      __pyx_t_9 = __pyx_v_ax;
      (__pyx_v_vecshape[__pyx_t_9]) = ((__pyx_v_vecshape[__pyx_t_9]) * (__pyx_v_vecshape[__pyx_v_last_ax]));
    }
    __pyx_L24_for_end:;

    /* "cupy/_core/_kernel.pyx":444
 *         else:
 *             vecshape[ax] *= vecshape[last_ax]
 *         last_ax = ax             # <<<<<<<<<<<<<<
 *     if last_ax >= 0:
 *         axes.push_back(last_ax)
*/
    __pyx_v_last_ax = __pyx_v_ax;
    __pyx_L16_continue:;
  }

  /* "cupy/_core/_kernel.pyx":445
 *             vecshape[ax] *= vecshape[last_ax]
 *         last_ax = ax
 *     if last_ax >= 0:             # <<<<<<<<<<<<<<
 *         axes.push_back(last_ax)
 *     if <int>axes.size() == ndim:
*/
  __pyx_t_5 = (__pyx_v_last_ax >= 0);
  if (__pyx_t_5) {

    /* "cupy/_core/_kernel.pyx":446
 *         last_ax = ax
 *     if last_ax >= 0:
 *         axes.push_back(last_ax)             # <<<<<<<<<<<<<<
 *     if <int>axes.size() == ndim:
 *         return shape
*/
    try {
      __pyx_v_axes.push_back(__pyx_v_last_ax);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 446, __pyx_L1_error)
    }

    /* "cupy/_core/_kernel.pyx":445
 *             vecshape[ax] *= vecshape[last_ax]
 *         last_ax = ax
 *     if last_ax >= 0:             # <<<<<<<<<<<<<<
 *         axes.push_back(last_ax)
 *     if <int>axes.size() == ndim:
*/
  }

  /* "cupy/_core/_kernel.pyx":447
 *     if last_ax >= 0:
 *         axes.push_back(last_ax)
 *     if <int>axes.size() == ndim:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  __pyx_t_5 = (((int)__pyx_v_axes.size()) == __pyx_v_ndim);
  if (__pyx_t_5) {

    /* "cupy/_core/_kernel.pyx":448
 *         axes.push_back(last_ax)
 *     if <int>axes.size() == ndim:
 *         return shape             # <<<<<<<<<<<<<<
 * 
 *     newshape.reserve(axes.size())
*/
    __pyx_r = __pyx_v_shape;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":447
 *     if last_ax >= 0:
 *         axes.push_back(last_ax)
 *     if <int>axes.size() == ndim:             # <<<<<<<<<<<<<<
 *         return shape
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":450
 *         return shape
 * 
 *     newshape.reserve(axes.size())             # <<<<<<<<<<<<<<
 *     newstrides.reserve(axes.size())
 *     for ax in axes:
*/
  try {
    __pyx_v_newshape.reserve(__pyx_v_axes.size());
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 450, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":451
 * 
 *     newshape.reserve(axes.size())
 *     newstrides.reserve(axes.size())             # <<<<<<<<<<<<<<
 *     for ax in axes:
 *         newshape.push_back(vecshape[ax])
*/
  try {
    __pyx_v_newstrides.reserve(__pyx_v_axes.size());
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 451, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":452
 *     newshape.reserve(axes.size())
 *     newstrides.reserve(axes.size())
 *     for ax in axes:             # <<<<<<<<<<<<<<
 *         newshape.push_back(vecshape[ax])
 *     for i in array_indexes:
*/
  __pyx_t_6 = __pyx_v_axes.begin();
  for (; __pyx_t_6 != __pyx_v_axes.end(); ++__pyx_t_6) {
    __pyx_t_3 = *__pyx_t_6;
    __pyx_v_ax = __pyx_t_3;

    /* "cupy/_core/_kernel.pyx":453
 *     newstrides.reserve(axes.size())
 *     for ax in axes:
 *         newshape.push_back(vecshape[ax])             # <<<<<<<<<<<<<<
 *     for i in array_indexes:
 *         arr = args[i]
*/
    try {
      __pyx_v_newshape.push_back((__pyx_v_vecshape[__pyx_v_ax]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 453, __pyx_L1_error)
    }

    /* "cupy/_core/_kernel.pyx":452
 *     newshape.reserve(axes.size())
 *     newstrides.reserve(axes.size())
 *     for ax in axes:             # <<<<<<<<<<<<<<
 *         newshape.push_back(vecshape[ax])
 *     for i in array_indexes:
*/
  }

  /* "cupy/_core/_kernel.pyx":454
 *     for ax in axes:
 *         newshape.push_back(vecshape[ax])
 *     for i in array_indexes:             # <<<<<<<<<<<<<<
 *         arr = args[i]
 *         newstrides.clear()
*/
  __pyx_t_6 = __pyx_v_array_indexes.begin();
  for (; __pyx_t_6 != __pyx_v_array_indexes.end(); ++__pyx_t_6) {
    __pyx_t_3 = *__pyx_t_6;
    __pyx_v_i = __pyx_t_3;

    /* "cupy/_core/_kernel.pyx":455
 *         newshape.push_back(vecshape[ax])
 *     for i in array_indexes:
 *         arr = args[i]             # <<<<<<<<<<<<<<
 *         newstrides.clear()
 *         for ax in axes:
*/
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 455, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":456
 *     for i in array_indexes:
 *         arr = args[i]
 *         newstrides.clear()             # <<<<<<<<<<<<<<
 *         for ax in axes:
 *             newstrides.push_back(arr._strides[ax])
*/
    __pyx_v_newstrides.clear();

    /* "cupy/_core/_kernel.pyx":457
 *         arr = args[i]
 *         newstrides.clear()
 *         for ax in axes:             # <<<<<<<<<<<<<<
 *             newstrides.push_back(arr._strides[ax])
 *         # TODO(niboshi): Confirm update_x_contiguity flags
*/
    __pyx_t_10 = __pyx_v_axes.begin();
    for (; __pyx_t_10 != __pyx_v_axes.end(); ++__pyx_t_10) {
      __pyx_t_3 = *__pyx_t_10;
      __pyx_v_ax = __pyx_t_3;

      /* "cupy/_core/_kernel.pyx":458
 *         newstrides.clear()
 *         for ax in axes:
 *             newstrides.push_back(arr._strides[ax])             # <<<<<<<<<<<<<<
 *         # TODO(niboshi): Confirm update_x_contiguity flags
 *         args[i] = arr._view(type(arr), newshape, newstrides, False, True, arr)
*/
      try {
        __pyx_v_newstrides.push_back((__pyx_v_arr->_strides[__pyx_v_ax]));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(0, 458, __pyx_L1_error)
      }

      /* "cupy/_core/_kernel.pyx":457
 *         arr = args[i]
 *         newstrides.clear()
 *         for ax in axes:             # <<<<<<<<<<<<<<
 *             newstrides.push_back(arr._strides[ax])
 *         # TODO(niboshi): Confirm update_x_contiguity flags
*/
    }

    /* "cupy/_core/_kernel.pyx":460
 *             newstrides.push_back(arr._strides[ax])
 *         # TODO(niboshi): Confirm update_x_contiguity flags
 *         args[i] = arr._view(type(arr), newshape, newstrides, False, True, arr)             # <<<<<<<<<<<<<<
 *     return newshape
 * 
*/
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *)__pyx_v_arr->__pyx_vtab)->_view(__pyx_v_arr, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_arr))), __pyx_v_newshape, __pyx_v_newstrides, 0, 1, ((PyObject *)__pyx_v_arr))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 460, __pyx_L1_error)
    }
    if (unlikely((__Pyx_SetItemInt(__pyx_v_args, __pyx_v_i, __pyx_t_4, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument) < 0))) __PYX_ERR(0, 460, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":454
 *     for ax in axes:
 *         newshape.push_back(vecshape[ax])
 *     for i in array_indexes:             # <<<<<<<<<<<<<<
 *         arr = args[i]
 *         newstrides.clear()
*/
  }

  /* "cupy/_core/_kernel.pyx":461
 *         # TODO(niboshi): Confirm update_x_contiguity flags
 *         args[i] = arr._view(type(arr), newshape, newstrides, False, True, arr)
 *     return newshape             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_newshape;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":382
 * 
 * 
 * cdef shape_t _reduced_view_core(             # <<<<<<<<<<<<<<
 *         list args, tuple params, const shape_t& shape) except *:
 *     cdef int i, ax, last_ax, ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._reduced_view_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":466
 * cdef class ParameterInfo:
 * 
 *     def __init__(self, str param, bint is_const):             # <<<<<<<<<<<<<<
 *         self.name = None
 *         self.dtype = None
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_param = 0;
  int __pyx_v_is_const;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_param,&__pyx_mstate_global->__pyx_n_u_is_const,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 466, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 466, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 466, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 466, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 466, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 466, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 466, __pyx_L3_error)
    }
    __pyx_v_param = ((PyObject*)values[0]);
    __pyx_v_is_const = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_is_const == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L3_error)
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 466, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_param), (&PyUnicode_Type), 1, "param", 1))) __PYX_ERR(0, 466, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo___init__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self), __pyx_v_param, __pyx_v_is_const);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v_param, int __pyx_v_is_const) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_i = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":467
 * 
 *     def __init__(self, str param, bint is_const):
 *         self.name = None             # <<<<<<<<<<<<<<
 *         self.dtype = None
 *         self.ctype = None
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)Py_None);

  /* "cupy/_core/_kernel.pyx":468
 *     def __init__(self, str param, bint is_const):
 *         self.name = None
 *         self.dtype = None             # <<<<<<<<<<<<<<
 *         self.ctype = None
 *         self.raw = False
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->dtype);
  __Pyx_DECREF(__pyx_v_self->dtype);
  __pyx_v_self->dtype = Py_None;

  /* "cupy/_core/_kernel.pyx":469
 *         self.name = None
 *         self.dtype = None
 *         self.ctype = None             # <<<<<<<<<<<<<<
 *         self.raw = False
 *         self.is_const = is_const
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->ctype);
  __Pyx_DECREF(__pyx_v_self->ctype);
  __pyx_v_self->ctype = ((PyObject*)Py_None);

  /* "cupy/_core/_kernel.pyx":470
 *         self.dtype = None
 *         self.ctype = None
 *         self.raw = False             # <<<<<<<<<<<<<<
 *         self.is_const = is_const
 *         s = tuple([i for i in param.split() if len(i) != 0])
*/
  __pyx_v_self->raw = 0;

  /* "cupy/_core/_kernel.pyx":471
 *         self.ctype = None
 *         self.raw = False
 *         self.is_const = is_const             # <<<<<<<<<<<<<<
 *         s = tuple([i for i in param.split() if len(i) != 0])
 *         if len(s) < 2:
*/
  __pyx_v_self->is_const = __pyx_v_is_const;

  /* "cupy/_core/_kernel.pyx":472
 *         self.raw = False
 *         self.is_const = is_const
 *         s = tuple([i for i in param.split() if len(i) != 0])             # <<<<<<<<<<<<<<
 *         if len(s) < 2:
 *             raise Exception('Syntax error: %s' % param)
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_param == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "split");
      __PYX_ERR(0, 472, __pyx_L5_error)
    }
    __pyx_t_2 = PyUnicode_Split(__pyx_v_param, ((PyObject *)NULL), -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 472, __pyx_L5_error)
        #endif
        if (__pyx_t_4 >= __pyx_temp) break;
      }
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_4;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_i, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = PyObject_Length(__pyx_8genexpr1__pyx_v_i); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 472, __pyx_L5_error)
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_i))) __PYX_ERR(0, 472, __pyx_L5_error)
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i); __pyx_8genexpr1__pyx_v_i = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i); __pyx_8genexpr1__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_t_3 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":473
 *         self.is_const = is_const
 *         s = tuple([i for i in param.split() if len(i) != 0])
 *         if len(s) < 2:             # <<<<<<<<<<<<<<
 *             raise Exception('Syntax error: %s' % param)
 * 
*/
  __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v_s); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 473, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_4 < 2);
  if (unlikely(__pyx_t_6)) {

    /* "cupy/_core/_kernel.pyx":474
 *         s = tuple([i for i in param.split() if len(i) != 0])
 *         if len(s) < 2:
 *             raise Exception('Syntax error: %s' % param)             # <<<<<<<<<<<<<<
 * 
 *         t, self.name = s[-2:]
*/
    __pyx_t_1 = NULL;
    __pyx_t_2 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Syntax_error_s, __pyx_v_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 474, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":473
 *         self.is_const = is_const
 *         s = tuple([i for i in param.split() if len(i) != 0])
 *         if len(s) < 2:             # <<<<<<<<<<<<<<
 *             raise Exception('Syntax error: %s' % param)
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":476
 *             raise Exception('Syntax error: %s' % param)
 * 
 *         t, self.name = s[-2:]             # <<<<<<<<<<<<<<
 *         if t == 'CIndexer':
 *             pass
*/
  __pyx_t_3 = __Pyx_PyTuple_GetSlice(__pyx_v_s, -2L, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (1) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 476, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 476, __pyx_L1_error)
  __pyx_v_t = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":477
 * 
 *         t, self.name = s[-2:]
 *         if t == 'CIndexer':             # <<<<<<<<<<<<<<
 *             pass
 *         elif len(t) == 1:
*/
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_t, __pyx_mstate_global->__pyx_n_u_CIndexer_2, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  if (__pyx_t_6) {
    goto __pyx_L12;
  }

  /* "cupy/_core/_kernel.pyx":479
 *         if t == 'CIndexer':
 *             pass
 *         elif len(t) == 1:             # <<<<<<<<<<<<<<
 *             self.ctype = t
 *         else:
*/
  __pyx_t_4 = PyObject_Length(__pyx_v_t); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 479, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_4 == 1);
  if (__pyx_t_6) {

    /* "cupy/_core/_kernel.pyx":480
 *             pass
 *         elif len(t) == 1:
 *             self.ctype = t             # <<<<<<<<<<<<<<
 *         else:
 *             dtype = get_dtype(t)
*/
    __pyx_t_3 = __pyx_v_t;
    __Pyx_INCREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->ctype);
    __Pyx_DECREF(__pyx_v_self->ctype);
    __pyx_v_self->ctype = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":479
 *         if t == 'CIndexer':
 *             pass
 *         elif len(t) == 1:             # <<<<<<<<<<<<<<
 *             self.ctype = t
 *         else:
*/
    goto __pyx_L12;
  }

  /* "cupy/_core/_kernel.pyx":482
 *             self.ctype = t
 *         else:
 *             dtype = get_dtype(t)             # <<<<<<<<<<<<<<
 *             self.dtype = dtype
 *             self.ctype = _get_typename(self.dtype)
*/
  /*else*/ {
    __pyx_t_3 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_t, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dtype = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":483
 *         else:
 *             dtype = get_dtype(t)
 *             self.dtype = dtype             # <<<<<<<<<<<<<<
 *             self.ctype = _get_typename(self.dtype)
 * 
*/
    __Pyx_INCREF(__pyx_v_dtype);
    __Pyx_GIVEREF(__pyx_v_dtype);
    __Pyx_GOTREF(__pyx_v_self->dtype);
    __Pyx_DECREF(__pyx_v_self->dtype);
    __pyx_v_self->dtype = __pyx_v_dtype;

    /* "cupy/_core/_kernel.pyx":484
 *             dtype = get_dtype(t)
 *             self.dtype = dtype
 *             self.ctype = _get_typename(self.dtype)             # <<<<<<<<<<<<<<
 * 
 *         for i in s[:-2]:
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_typename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_self->dtype};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 484, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->ctype);
    __Pyx_DECREF(__pyx_v_self->ctype);
    __pyx_v_self->ctype = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L12:;

  /* "cupy/_core/_kernel.pyx":486
 *             self.ctype = _get_typename(self.dtype)
 * 
 *         for i in s[:-2]:             # <<<<<<<<<<<<<<
 *             if i == 'raw':
 *                 self.raw = True
*/
  __pyx_t_3 = __Pyx_PyTuple_GetSlice(__pyx_v_s, 0, -2L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 486, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
    #endif
    ++__pyx_t_4;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":487
 * 
 *         for i in s[:-2]:
 *             if i == 'raw':             # <<<<<<<<<<<<<<
 *                 self.raw = True
 *             elif i == '_non_const':
*/
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_i, __pyx_mstate_global->__pyx_n_u_raw_2, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 487, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "cupy/_core/_kernel.pyx":488
 *         for i in s[:-2]:
 *             if i == 'raw':
 *                 self.raw = True             # <<<<<<<<<<<<<<
 *             elif i == '_non_const':
 *                 self.is_const = False
*/
      __pyx_v_self->raw = 1;

      /* "cupy/_core/_kernel.pyx":487
 * 
 *         for i in s[:-2]:
 *             if i == 'raw':             # <<<<<<<<<<<<<<
 *                 self.raw = True
 *             elif i == '_non_const':
*/
      goto __pyx_L15;
    }

    /* "cupy/_core/_kernel.pyx":489
 *             if i == 'raw':
 *                 self.raw = True
 *             elif i == '_non_const':             # <<<<<<<<<<<<<<
 *                 self.is_const = False
 *             else:
*/
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_i, __pyx_mstate_global->__pyx_n_u_non_const, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 489, __pyx_L1_error)
    if (likely(__pyx_t_6)) {

      /* "cupy/_core/_kernel.pyx":490
 *                 self.raw = True
 *             elif i == '_non_const':
 *                 self.is_const = False             # <<<<<<<<<<<<<<
 *             else:
 *                 raise Exception('Unknown keyword "%s"' % i)
*/
      __pyx_v_self->is_const = 0;

      /* "cupy/_core/_kernel.pyx":489
 *             if i == 'raw':
 *                 self.raw = True
 *             elif i == '_non_const':             # <<<<<<<<<<<<<<
 *                 self.is_const = False
 *             else:
*/
      goto __pyx_L15;
    }

    /* "cupy/_core/_kernel.pyx":492
 *                 self.is_const = False
 *             else:
 *                 raise Exception('Unknown keyword "%s"' % i)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
    /*else*/ {
      __pyx_t_1 = NULL;
      __pyx_t_8 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Unknown_keyword_s, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 492, __pyx_L1_error)
    }
    __pyx_L15:;

    /* "cupy/_core/_kernel.pyx":486
 *             self.ctype = _get_typename(self.dtype)
 * 
 *         for i in s[:-2]:             # <<<<<<<<<<<<<<
 *             if i == 'raw':
 *                 self.raw = True
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":466
 * cdef class ParameterInfo:
 * 
 *     def __init__(self, str param, bint is_const):             # <<<<<<<<<<<<<<
 *         self.name = None
 *         self.dtype = None
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":494
 *                 raise Exception('Unknown keyword "%s"' % i)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash((
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_2__hash__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_hash_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "cupy/_core/_kernel.pyx":496
 *     def __hash__(self):
 *         return hash((
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->raw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->is_const); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->name) != (0)) __PYX_ERR(0, 496, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __Pyx_GIVEREF(__pyx_v_self->dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->dtype) != (0)) __PYX_ERR(0, 496, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->ctype);
  __Pyx_GIVEREF(__pyx_v_self->ctype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->ctype) != (0)) __PYX_ERR(0, 496, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1) != (0)) __PYX_ERR(0, 496, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2) != (0)) __PYX_ERR(0, 496, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":495
 * 
 *     def __hash__(self):
 *         return hash((             # <<<<<<<<<<<<<<
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))
 * 
*/
  __pyx_t_4 = PyObject_Hash(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_hash_t)-1))) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":494
 *                 raise Exception('Unknown keyword "%s"' % i)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash((
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":498
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef ParameterInfo oth
 *         if not isinstance(other, ParameterInfo):
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4__eq__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_oth = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "cupy/_core/_kernel.pyx":500
 *     def __eq__(self, other):
 *         cdef ParameterInfo oth
 *         if not isinstance(other, ParameterInfo):             # <<<<<<<<<<<<<<
 *             return False
 *         oth = other
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":501
 *         cdef ParameterInfo oth
 *         if not isinstance(other, ParameterInfo):
 *             return False             # <<<<<<<<<<<<<<
 *         oth = other
 *         return (
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":500
 *     def __eq__(self, other):
 *         cdef ParameterInfo oth
 *         if not isinstance(other, ParameterInfo):             # <<<<<<<<<<<<<<
 *             return False
 *         oth = other
*/
  }

  /* "cupy/_core/_kernel.pyx":502
 *         if not isinstance(other, ParameterInfo):
 *             return False
 *         oth = other             # <<<<<<<<<<<<<<
 *         return (
 *             self.name == oth.name
*/
  __pyx_t_3 = __pyx_v_other;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 502, __pyx_L1_error)
  __pyx_v_oth = ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":503
 *             return False
 *         oth = other
 *         return (             # <<<<<<<<<<<<<<
 *             self.name == oth.name
 *             and self.dtype == oth.dtype
*/
  __Pyx_XDECREF(__pyx_r);

  /* "cupy/_core/_kernel.pyx":504
 *         oth = other
 *         return (
 *             self.name == oth.name             # <<<<<<<<<<<<<<
 *             and self.dtype == oth.dtype
 *             and self.ctype == oth.ctype
*/
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_v_oth->name, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 504, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":505
 *         return (
 *             self.name == oth.name
 *             and self.dtype == oth.dtype             # <<<<<<<<<<<<<<
 *             and self.ctype == oth.ctype
 *             and self.raw == oth.raw
*/
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->dtype, __pyx_v_oth->dtype, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 505, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":506
 *             self.name == oth.name
 *             and self.dtype == oth.dtype
 *             and self.ctype == oth.ctype             # <<<<<<<<<<<<<<
 *             and self.raw == oth.raw
 *             and self.is_const == oth.is_const)
*/
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->ctype, __pyx_v_oth->ctype, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 506, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":507
 *             and self.dtype == oth.dtype
 *             and self.ctype == oth.ctype
 *             and self.raw == oth.raw             # <<<<<<<<<<<<<<
 *             and self.is_const == oth.is_const)
 * 
*/
  __pyx_t_2 = (__pyx_v_self->raw == __pyx_v_oth->raw);
  if (__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":508
 *             and self.ctype == oth.ctype
 *             and self.raw == oth.raw
 *             and self.is_const == oth.is_const)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_t_2 = (__pyx_v_self->is_const == __pyx_v_oth->is_const);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":498
 *             self.name, self.dtype, self.ctype, self.raw, self.is_const))
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         cdef ParameterInfo oth
 *         if not isinstance(other, ParameterInfo):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_oth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":510
 *             and self.is_const == oth.is_const)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ParameterInfo({})>'.format(
 *             ' '.join([
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_7__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_6__repr__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_6__repr__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cupy/_core/_kernel.pyx":511
 * 
 *     def __repr__(self):
 *         return '<ParameterInfo({})>'.format(             # <<<<<<<<<<<<<<
 *             ' '.join([
 *                 'name={!r}'.format(self.name),
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_ParameterInfo;
  __Pyx_INCREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":513
 *         return '<ParameterInfo({})>'.format(
 *             ' '.join([
 *                 'name={!r}'.format(self.name),             # <<<<<<<<<<<<<<
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ctype={!r}'.format(self.ctype),
*/
  __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u_name_r;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->name};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }

  /* "cupy/_core/_kernel.pyx":514
 *             ' '.join([
 *                 'name={!r}'.format(self.name),
 *                 'dtype={!r}'.format(self.dtype),             # <<<<<<<<<<<<<<
 *                 'ctype={!r}'.format(self.ctype),
 *                 'raw={!r}'.format(self.raw),
*/
  __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_dtype_r;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_self->dtype};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }

  /* "cupy/_core/_kernel.pyx":515
 *                 'name={!r}'.format(self.name),
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ctype={!r}'.format(self.ctype),             # <<<<<<<<<<<<<<
 *                 'raw={!r}'.format(self.raw),
 *                 'is_const={!r}'.format(self.is_const),
*/
  __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u_ctype_r;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_self->ctype};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }

  /* "cupy/_core/_kernel.pyx":516
 *                 'dtype={!r}'.format(self.dtype),
 *                 'ctype={!r}'.format(self.ctype),
 *                 'raw={!r}'.format(self.raw),             # <<<<<<<<<<<<<<
 *                 'is_const={!r}'.format(self.is_const),
 *             ]))
*/
  __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_raw_r;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->raw); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9};
    __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }

  /* "cupy/_core/_kernel.pyx":517
 *                 'ctype={!r}'.format(self.ctype),
 *                 'raw={!r}'.format(self.raw),
 *                 'is_const={!r}'.format(self.is_const),             # <<<<<<<<<<<<<<
 *             ]))
 * 
*/
  __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_is_const_r;
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_v_self->is_const); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_10};
    __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }

  /* "cupy/_core/_kernel.pyx":512
 *     def __repr__(self):
 *         return '<ParameterInfo({})>'.format(
 *             ' '.join([             # <<<<<<<<<<<<<<
 *                 'name={!r}'.format(self.name),
 *                 'dtype={!r}'.format(self.dtype),
*/
  __pyx_t_10 = PyList_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 512, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 512, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_6) != (0)) __PYX_ERR(0, 512, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 3, __pyx_t_7) != (0)) __PYX_ERR(0, 512, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_9);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_9) != (0)) __PYX_ERR(0, 512, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__4, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":510
 *             and self.is_const == oth.is_const)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ParameterInfo({})>'.format(
 *             ' '.join([
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":13
 * cdef class ParameterInfo:
 *     cdef:
 *         readonly str name             # <<<<<<<<<<<<<<
 *         readonly object dtype
 *         readonly str ctype
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4name___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":14
 *     cdef:
 *         readonly str name
 *         readonly object dtype             # <<<<<<<<<<<<<<
 *         readonly str ctype
 *         readonly bint raw
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5dtype_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5dtype_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5dtype___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5dtype___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __pyx_r = __pyx_v_self->dtype;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":15
 *         readonly str name
 *         readonly object dtype
 *         readonly str ctype             # <<<<<<<<<<<<<<
 *         readonly bint raw
 *         readonly bint is_const
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5ctype_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5ctype_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5ctype___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_5ctype___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->ctype);
  __pyx_r = __pyx_v_self->ctype;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":16
 *         readonly object dtype
 *         readonly str ctype
 *         readonly bint raw             # <<<<<<<<<<<<<<
 *         readonly bint is_const
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3raw_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3raw_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_3raw___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_3raw___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->raw); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.raw.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":17
 *         readonly str ctype
 *         readonly bint raw
 *         readonly bint is_const             # <<<<<<<<<<<<<<
 * 
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_8is_const_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_8is_const_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8is_const___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8is_const___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_const); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.is_const.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_13ParameterInfo_8__reduce_cython__, "ParameterInfo.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.ctype, self.dtype, self.is_const, self.name, self.raw)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_const); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->raw); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->ctype);
  __Pyx_GIVEREF(__pyx_v_self->ctype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->ctype) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->dtype);
  __Pyx_GIVEREF(__pyx_v_self->dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->dtype) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->name) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.ctype, self.dtype, self.is_const, self.name, self.raw)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self.ctype, self.dtype, self.is_const, self.name, self.raw)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.ctype is not None or self.dtype is not None or self.name is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.ctype, self.dtype, self.is_const, self.name, self.raw)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.ctype is not None or self.dtype is not None or self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, None), state
*/
  /*else*/ {
    __pyx_t_5 = (__pyx_v_self->ctype != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->dtype != Py_None);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->name != ((PyObject*)Py_None));
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_4;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.ctype is not None or self.dtype is not None or self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.ctype is not None or self.dtype is not None or self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ParameterInfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_17460680);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_17460680);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_17460680) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.ctype is not None or self.dtype is not None or self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, None), state
 *     else:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ParameterInfo__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ParameterInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_17460680);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_17460680);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_17460680) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ParameterInfo__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_13ParameterInfo_10__setstate_cython__, "ParameterInfo.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_10__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_13ParameterInfo_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ParameterInfo__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ParameterInfo__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ParameterInfo, (type(self), 0x10a6dc8, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ParameterInfo__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel.ParameterInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":521
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_9_get_param_info(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_8_get_param_info, "_get_param_info(str s, is_const)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_9_get_param_info = {"_get_param_info", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_9_get_param_info, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_8_get_param_info};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_9_get_param_info(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_is_const = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_param_info (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_s,&__pyx_mstate_global->__pyx_n_u_is_const,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 521, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 521, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 521, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_param_info", 0) < (0)) __PYX_ERR(0, 521, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_param_info", 1, 2, 2, i); __PYX_ERR(0, 521, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 521, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 521, __pyx_L3_error)
    }
    __pyx_v_s = ((PyObject*)values[0]);
    __pyx_v_is_const = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_param_info", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 521, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._get_param_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PyUnicode_Type), 1, "s", 1))) __PYX_ERR(0, 522, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_get_param_info(__pyx_self, __pyx_v_s, __pyx_v_is_const);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_get_param_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_is_const) {
  PyObject *__pyx_8genexpr2__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_param_info", 0);

  /* "cupy/_core/_kernel.pyx":523
 * @_util.memoize()
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:             # <<<<<<<<<<<<<<
 *         return ()
 *     return tuple([ParameterInfo(i, is_const) for i in s.strip().split(',')])
*/
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 523, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_s); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 523, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":524
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:
 *         return ()             # <<<<<<<<<<<<<<
 *     return tuple([ParameterInfo(i, is_const) for i in s.strip().split(',')])
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":523
 * @_util.memoize()
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:             # <<<<<<<<<<<<<<
 *         return ()
 *     return tuple([ParameterInfo(i, is_const) for i in s.strip().split(',')])
*/
  }

  /* "cupy/_core/_kernel.pyx":525
 *     if len(s) == 0:
 *         return ()
 *     return tuple([ParameterInfo(i, is_const) for i in s.strip().split(',')])             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__strip, __pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyUnicode_Split(((PyObject*)__pyx_t_4), __pyx_mstate_global->__pyx_kp_u__8, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 525, __pyx_L6_error)
        #endif
        if (__pyx_t_1 >= __pyx_temp) break;
      }
      __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_1;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_i, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_8genexpr2__pyx_v_i, __pyx_v_is_const};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L6_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 525, __pyx_L6_error)
      __Pyx_DECREF((PyObject *)__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_i); __pyx_8genexpr2__pyx_v_i = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_i); __pyx_8genexpr2__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":521
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel._get_param_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":528
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_11_decide_params_type(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_10_decide_params_type, "_decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_11_decide_params_type = {"_decide_params_type", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_11_decide_params_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_10_decide_params_type};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_11_decide_params_type(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_in_params = 0;
  PyObject *__pyx_v_out_params = 0;
  PyObject *__pyx_v_in_args_dtype = 0;
  PyObject *__pyx_v_out_args_dtype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decide_params_type (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_params,&__pyx_mstate_global->__pyx_n_u_out_params,&__pyx_mstate_global->__pyx_n_u_in_args_dtype,&__pyx_mstate_global->__pyx_n_u_out_args_dtype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 528, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 528, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 528, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 528, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 528, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_decide_params_type", 0) < (0)) __PYX_ERR(0, 528, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_decide_params_type", 1, 4, 4, i); __PYX_ERR(0, 528, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 528, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 528, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 528, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 528, __pyx_L3_error)
    }
    __pyx_v_in_params = values[0];
    __pyx_v_out_params = values[1];
    __pyx_v_in_args_dtype = values[2];
    __pyx_v_out_args_dtype = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_decide_params_type", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 528, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._decide_params_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_10_decide_params_type(__pyx_self, __pyx_v_in_params, __pyx_v_out_params, __pyx_v_in_args_dtype, __pyx_v_out_args_dtype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_10_decide_params_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_params, PyObject *__pyx_v_out_params, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decide_params_type", 0);

  /* "cupy/_core/_kernel.pyx":530
 * @_util.memoize()
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,             # <<<<<<<<<<<<<<
 *                                     out_args_dtype)
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_in_params;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 530, __pyx_L1_error)
  __pyx_t_2 = __pyx_v_out_params;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 530, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_in_args_dtype;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_3))) __PYX_ERR(0, 530, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":531
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,
 *                                     out_args_dtype)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_v_out_args_dtype;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_4))) __PYX_ERR(0, 531, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":530
 * @_util.memoize()
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,             # <<<<<<<<<<<<<<
 *                                     out_args_dtype)
 * 
*/
  __pyx_t_5 = __pyx_f_4cupy_5_core_7_kernel__decide_params_type_core(((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":528
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._decide_params_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":536
 * cdef class _TypeMap:
 * 
 *     def __init__(self, pairs):             # <<<<<<<<<<<<<<
 *         self._pairs = pairs
 * 
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pairs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pairs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 536, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 536, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 536, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 536, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 536, __pyx_L3_error)
    }
    __pyx_v_pairs = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 536, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap___init__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self), __pyx_v_pairs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap___init__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_pairs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":537
 * 
 *     def __init__(self, pairs):
 *         self._pairs = pairs             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __pyx_t_1 = __pyx_v_pairs;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pairs);
  __Pyx_DECREF(__pyx_v_self->_pairs);
  __pyx_v_self->_pairs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":536
 * cdef class _TypeMap:
 * 
 *     def __init__(self, pairs):             # <<<<<<<<<<<<<<
 *         self._pairs = pairs
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":539
 *         self._pairs = pairs
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._pairs)
 * 
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_3__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_3__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_2__hash__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_2__hash__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_hash_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "cupy/_core/_kernel.pyx":540
 * 
 *     def __hash__(self):
 *         return hash(self._pairs)             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __pyx_t_1 = __pyx_v_self->_pairs;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":539
 *         self._pairs = pairs
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(self._pairs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":542
 *         return hash(self._pairs)
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, _TypeMap):
 *             return False
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_5__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_4__eq__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_4__eq__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "cupy/_core/_kernel.pyx":543
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, _TypeMap):             # <<<<<<<<<<<<<<
 *             return False
 *         return self._pairs == (<_TypeMap>other)._pairs
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":544
 *     def __eq__(self, other):
 *         if not isinstance(other, _TypeMap):
 *             return False             # <<<<<<<<<<<<<<
 *         return self._pairs == (<_TypeMap>other)._pairs
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":543
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, _TypeMap):             # <<<<<<<<<<<<<<
 *             return False
 *         return self._pairs == (<_TypeMap>other)._pairs
*/
  }

  /* "cupy/_core/_kernel.pyx":545
 *         if not isinstance(other, _TypeMap):
 *             return False
 *         return self._pairs == (<_TypeMap>other)._pairs             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_self->_pairs, ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_other)->_pairs, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":542
 *         return hash(self._pairs)
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, _TypeMap):
 *             return False
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":547
 *         return self._pairs == (<_TypeMap>other)._pairs
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '<_TypeMap {}>'.format(self._pairs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_7__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6__str__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6__str__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cupy/_core/_kernel.pyx":548
 * 
 *     def __str__(self):
 *         return '<_TypeMap {}>'.format(self._pairs)             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_typedef_code(self, type_decls=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u_TypeMap;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->_pairs};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":547
 *         return self._pairs == (<_TypeMap>other)._pairs
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return '<_TypeMap {}>'.format(self._pairs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":550
 *         return '<_TypeMap {}>'.format(self._pairs)
 * 
 *     cdef str get_typedef_code(self, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns a code fragment of typedef statements used as preamble.
 *         return ''.join([
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code *__pyx_optional_args) {
  PyObject *__pyx_v_type_decls = ((PyObject *)Py_None);
  PyObject *__pyx_8genexpr3__pyx_v_ctype1 = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_ctype2 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_typedef_code", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_type_decls = __pyx_optional_args->type_decls;
    }
  }

  /* "cupy/_core/_kernel.pyx":552
 *     cdef str get_typedef_code(self, type_decls=None):
 *         # Returns a code fragment of typedef statements used as preamble.
 *         return ''.join([             # <<<<<<<<<<<<<<
 *             'typedef %s %s;\n' % (_get_typename(ctype2, type_decls), ctype1)
 *             for ctype1, ctype2 in self._pairs])
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/_core/_kernel.pyx":554
 *         return ''.join([
 *             'typedef %s %s;\n' % (_get_typename(ctype2, type_decls), ctype1)
 *             for ctype1, ctype2 in self._pairs])             # <<<<<<<<<<<<<<
 * 
 * 
*/
    if (unlikely(__pyx_v_self->_pairs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 554, __pyx_L5_error)
    }
    __pyx_t_2 = __pyx_v_self->_pairs; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 554, __pyx_L5_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
      #endif
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 554, __pyx_L5_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_6);
        } else {
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L5_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 554, __pyx_L5_error)
          __Pyx_XGOTREF(__pyx_t_6);
        }
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 554, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 554, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 554, __pyx_L5_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 554, __pyx_L5_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_ctype1, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_ctype2, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "cupy/_core/_kernel.pyx":553
 *         # Returns a code fragment of typedef statements used as preamble.
 *         return ''.join([
 *             'typedef %s %s;\n' % (_get_typename(ctype2, type_decls), ctype1)             # <<<<<<<<<<<<<<
 *             for ctype1, ctype2 in self._pairs])
 * 
*/
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_typename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_8genexpr3__pyx_v_ctype2);
      __Pyx_GIVEREF(__pyx_8genexpr3__pyx_v_ctype2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_8genexpr3__pyx_v_ctype2) != (0)) __PYX_ERR(0, 553, __pyx_L5_error);
      __Pyx_INCREF(__pyx_v_type_decls);
      __Pyx_GIVEREF(__pyx_v_type_decls);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_type_decls) != (0)) __PYX_ERR(0, 553, __pyx_L5_error);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_8genexpr3__pyx_v_ctype1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_typedef;
      __pyx_t_9[1] = __pyx_t_6;
      __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u__4;
      __pyx_t_9[3] = __pyx_t_5;
      __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__9;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 552, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":554
 *         return ''.join([
 *             'typedef %s %s;\n' % (_get_typename(ctype2, type_decls), ctype1)
 *             for ctype1, ctype2 in self._pairs])             # <<<<<<<<<<<<<<
 * 
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype1); __pyx_8genexpr3__pyx_v_ctype1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype2); __pyx_8genexpr3__pyx_v_ctype2 = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype1); __pyx_8genexpr3__pyx_v_ctype1 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype2); __pyx_8genexpr3__pyx_v_ctype2 = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */

  /* "cupy/_core/_kernel.pyx":552
 *     cdef str get_typedef_code(self, type_decls=None):
 *         # Returns a code fragment of typedef statements used as preamble.
 *         return ''.join([             # <<<<<<<<<<<<<<
 *             'typedef %s %s;\n' % (_get_typename(ctype2, type_decls), ctype1)
 *             for ctype1, ctype2 in self._pairs])
*/
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":550
 *         return '<_TypeMap {}>'.format(self._pairs)
 * 
 *     cdef str get_typedef_code(self, type_decls=None):             # <<<<<<<<<<<<<<
 *         # Returns a code fragment of typedef statements used as preamble.
 *         return ''.join([
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.get_typedef_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype1);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_ctype2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":85
 * 
 *     cdef public:
 *         tuple _pairs             # <<<<<<<<<<<<<<
 * 
 *     cdef str get_typedef_code(self, type_decls=*)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs___get__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_pairs);
  __pyx_r = __pyx_v_self->_pairs;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_2__set__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_2__set__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(6, 85, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_pairs);
  __Pyx_DECREF(__pyx_v_self->_pairs);
  __pyx_v_self->_pairs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap._pairs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_4__del__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_4__del__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_pairs);
  __Pyx_DECREF(__pyx_v_self->_pairs);
  __pyx_v_self->_pairs = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_8_TypeMap_8__reduce_cython__, "_TypeMap.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_8__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._pairs,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->_pairs);
  __Pyx_GIVEREF(__pyx_v_self->_pairs);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_pairs) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._pairs,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self._pairs,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._pairs is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._pairs,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._pairs is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, None), state
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_self->_pairs != ((PyObject*)Py_None));
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._pairs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self._pairs is not None
 *     if use_setstate:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__TypeMap); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_202451496);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_202451496);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_202451496) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._pairs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, None), state
 *     else:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__TypeMap__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__TypeMap); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_202451496);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_202451496);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_202451496) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__TypeMap__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_8_TypeMap_10__setstate_cython__, "_TypeMap.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_10__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_8_TypeMap_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__TypeMap__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__TypeMap__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__TypeMap, (type(self), 0xc112a28, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__TypeMap__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._TypeMap.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":557
 * 
 * 
 * cdef tuple _decide_params_type_core(             # <<<<<<<<<<<<<<
 *         tuple in_params, tuple out_params, tuple in_args_dtype,
 *         tuple out_args_dtype):
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__decide_params_type_core(PyObject *__pyx_v_in_params, PyObject *__pyx_v_out_params, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype) {
  PyObject *__pyx_v_type_dict = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_unknown_ctype = NULL;
  PyObject *__pyx_v_in_types = NULL;
  PyObject *__pyx_v_out_types = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_p = NULL;
  PyObject *__pyx_8genexpr5__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14[6];
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16[8];
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decide_params_type_core", 0);

  /* "cupy/_core/_kernel.pyx":560
 *         tuple in_params, tuple out_params, tuple in_args_dtype,
 *         tuple out_args_dtype):
 *     type_dict = {}             # <<<<<<<<<<<<<<
 *     if out_args_dtype:
 *         assert len(out_params) == len(out_args_dtype)
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_type_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":561
 *         tuple out_args_dtype):
 *     type_dict = {}
 *     if out_args_dtype:             # <<<<<<<<<<<<<<
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):
*/
  if (__pyx_v_out_args_dtype == Py_None) __pyx_t_2 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_v_out_args_dtype);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 561, __pyx_L1_error)
    __pyx_t_2 = (__pyx_temp != 0);
  }

  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":562
 *     type_dict = {}
 *     if out_args_dtype:
 *         assert len(out_params) == len(out_args_dtype)             # <<<<<<<<<<<<<<
 *         for p, a in zip(out_params, out_args_dtype):
 *             if a is None:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(__pyx_v_out_params == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 562, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v_out_params); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
      if (unlikely(__pyx_v_out_args_dtype == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 562, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v_out_args_dtype); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_3 == __pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(0, 562, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 562, __pyx_L1_error)
    #endif

    /* "cupy/_core/_kernel.pyx":563
 *     if out_args_dtype:
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):             # <<<<<<<<<<<<<<
 *             if a is None:
 *                 raise TypeError('Output arguments must be cupy.ndarray')
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_out_params, __pyx_v_out_args_dtype};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 563, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 563, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 563, __pyx_L1_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4));
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
      } else {
        __pyx_t_1 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 563, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 563, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_8);
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 563, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 563, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
        }
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 563, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 563, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 563, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 563, __pyx_L1_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 563, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "cupy/_core/_kernel.pyx":564
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):
 *             if a is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:
*/
      __pyx_t_2 = (__pyx_v_a == Py_None);
      if (unlikely(__pyx_t_2)) {

        /* "cupy/_core/_kernel.pyx":565
 *         for p, a in zip(out_params, out_args_dtype):
 *             if a is None:
 *                 raise TypeError('Output arguments must be cupy.ndarray')             # <<<<<<<<<<<<<<
 *             if p.dtype is not None:
 *                 if get_dtype(a) != get_dtype(p.dtype):
*/
        __pyx_t_9 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_Output_arguments_must_be_cupy_nd};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 565, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":564
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):
 *             if a is None:             # <<<<<<<<<<<<<<
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:
*/
      }

      /* "cupy/_core/_kernel.pyx":566
 *             if a is None:
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:             # <<<<<<<<<<<<<<
 *                 if get_dtype(a) != get_dtype(p.dtype):
 *                     raise TypeError(
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = (__pyx_t_1 != Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_2) {

        /* "cupy/_core/_kernel.pyx":567
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:
 *                 if get_dtype(a) != get_dtype(p.dtype):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
*/
        __pyx_t_1 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_a, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_t_9, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 567, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 567, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(__pyx_t_2)) {

          /* "cupy/_core/_kernel.pyx":568
 *             if p.dtype is not None:
 *                 if get_dtype(a) != get_dtype(p.dtype):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:
*/
          __pyx_t_8 = NULL;

          /* "cupy/_core/_kernel.pyx":569
 *                 if get_dtype(a) != get_dtype(p.dtype):
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))             # <<<<<<<<<<<<<<
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
*/
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_a), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_12), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_Type_is_mismatched;
          __pyx_t_14[1] = __pyx_t_10;
          __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_14[3] = __pyx_t_1;
          __pyx_t_14[4] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_14[5] = __pyx_t_13;
          __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_12};
            __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 568, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(0, 568, __pyx_L1_error)

          /* "cupy/_core/_kernel.pyx":567
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:
 *                 if get_dtype(a) != get_dtype(p.dtype):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
*/
        }

        /* "cupy/_core/_kernel.pyx":566
 *             if a is None:
 *                 raise TypeError('Output arguments must be cupy.ndarray')
 *             if p.dtype is not None:             # <<<<<<<<<<<<<<
 *                 if get_dtype(a) != get_dtype(p.dtype):
 *                     raise TypeError(
*/
        goto __pyx_L9;
      }

      /* "cupy/_core/_kernel.pyx":570
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:             # <<<<<<<<<<<<<<
 *                 t = type_dict[p.ctype]
 *                 if get_dtype(t) != get_dtype(a):
*/
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_t_9, __pyx_v_type_dict, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 570, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_2) {

        /* "cupy/_core/_kernel.pyx":571
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]             # <<<<<<<<<<<<<<
 *                 if get_dtype(t) != get_dtype(a):
 *                     raise TypeError(
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 571, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_type_dict, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 571, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "cupy/_core/_kernel.pyx":572
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
 *                 if get_dtype(t) != get_dtype(a):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
*/
        __pyx_t_12 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_t, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 572, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_a, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 572, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_12, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 572, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 572, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(__pyx_t_2)) {

          /* "cupy/_core/_kernel.pyx":573
 *                 t = type_dict[p.ctype]
 *                 if get_dtype(t) != get_dtype(a):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'Type is mismatched. %s %s %s %s' % (
 *                             p.name, a, t, p.ctype))
*/
          __pyx_t_9 = NULL;

          /* "cupy/_core/_kernel.pyx":575
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
 *                             p.name, a, t, p.ctype))             # <<<<<<<<<<<<<<
 *             else:
 *                 type_dict[p.ctype] = a
*/
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_12), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_a), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_t), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_15 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_10), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 575, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_Type_is_mismatched;
          __pyx_t_16[1] = __pyx_t_13;
          __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[3] = __pyx_t_12;
          __pyx_t_16[4] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[5] = __pyx_t_1;
          __pyx_t_16[6] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[7] = __pyx_t_15;

          /* "cupy/_core/_kernel.pyx":574
 *                 if get_dtype(t) != get_dtype(a):
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (             # <<<<<<<<<<<<<<
 *                             p.name, a, t, p.ctype))
 *             else:
*/
          __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_16, 8, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15));
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 574, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_10};
            __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 573, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(0, 573, __pyx_L1_error)

          /* "cupy/_core/_kernel.pyx":572
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
 *                 if get_dtype(t) != get_dtype(a):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
*/
        }

        /* "cupy/_core/_kernel.pyx":570
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:             # <<<<<<<<<<<<<<
 *                 t = type_dict[p.ctype]
 *                 if get_dtype(t) != get_dtype(a):
*/
        goto __pyx_L9;
      }

      /* "cupy/_core/_kernel.pyx":577
 *                             p.name, a, t, p.ctype))
 *             else:
 *                 type_dict[p.ctype] = a             # <<<<<<<<<<<<<<
 * 
 *     assert len(in_params) == len(in_args_dtype)
*/
      /*else*/ {
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 577, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely((PyDict_SetItem(__pyx_v_type_dict, __pyx_t_8, __pyx_v_a) < 0))) __PYX_ERR(0, 577, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __pyx_L9:;

      /* "cupy/_core/_kernel.pyx":563
 *     if out_args_dtype:
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):             # <<<<<<<<<<<<<<
 *             if a is None:
 *                 raise TypeError('Output arguments must be cupy.ndarray')
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":561
 *         tuple out_args_dtype):
 *     type_dict = {}
 *     if out_args_dtype:             # <<<<<<<<<<<<<<
 *         assert len(out_params) == len(out_args_dtype)
 *         for p, a in zip(out_params, out_args_dtype):
*/
  }

  /* "cupy/_core/_kernel.pyx":579
 *                 type_dict[p.ctype] = a
 * 
 *     assert len(in_params) == len(in_args_dtype)             # <<<<<<<<<<<<<<
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?
 *     for p, a in zip(in_params, in_args_dtype):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(__pyx_v_in_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 579, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v_in_params); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 579, __pyx_L1_error)
    if (unlikely(__pyx_v_in_args_dtype == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 579, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v_in_args_dtype); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 579, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_4 == __pyx_t_3);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 579, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 579, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":580
 * 
 *     assert len(in_params) == len(in_args_dtype)
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?             # <<<<<<<<<<<<<<
 *     for p, a in zip(in_params, in_args_dtype):
 *         if a is None:
*/
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_unknown_ctype = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":581
 *     assert len(in_params) == len(in_args_dtype)
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?
 *     for p, a in zip(in_params, in_args_dtype):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             if p.dtype is None:
*/
  __pyx_t_8 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_in_params, __pyx_v_in_args_dtype};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_8 = __pyx_t_5; __Pyx_INCREF(__pyx_t_8);
    __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_8))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 581, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 581, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_7(__pyx_t_8);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 581, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_5);
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 581, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_9);
      } else {
        __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 581, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_10);
        __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 581, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_9);
      }
      #else
      __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
      index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_15); if (unlikely(!__pyx_t_10)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_15), 2) < (0)) __PYX_ERR(0, 581, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 581, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "cupy/_core/_kernel.pyx":582
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?
 *     for p, a in zip(in_params, in_args_dtype):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             if p.dtype is None:
 *                 unknown_ctype.append(p.ctype)
*/
    __pyx_t_2 = (__pyx_v_a == Py_None);
    if (__pyx_t_2) {

      /* "cupy/_core/_kernel.pyx":583
 *     for p, a in zip(in_params, in_args_dtype):
 *         if a is None:
 *             if p.dtype is None:             # <<<<<<<<<<<<<<
 *                 unknown_ctype.append(p.ctype)
 *         else:
*/
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = (__pyx_t_5 == Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {

        /* "cupy/_core/_kernel.pyx":584
 *         if a is None:
 *             if p.dtype is None:
 *                 unknown_ctype.append(p.ctype)             # <<<<<<<<<<<<<<
 *         else:
 *             if p.dtype is not None:
*/
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_unknown_ctype, __pyx_t_5); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "cupy/_core/_kernel.pyx":583
 *     for p, a in zip(in_params, in_args_dtype):
 *         if a is None:
 *             if p.dtype is None:             # <<<<<<<<<<<<<<
 *                 unknown_ctype.append(p.ctype)
 *         else:
*/
      }

      /* "cupy/_core/_kernel.pyx":582
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?
 *     for p, a in zip(in_params, in_args_dtype):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             if p.dtype is None:
 *                 unknown_ctype.append(p.ctype)
*/
      goto __pyx_L17;
    }

    /* "cupy/_core/_kernel.pyx":586
 *                 unknown_ctype.append(p.ctype)
 *         else:
 *             if p.dtype is not None:             # <<<<<<<<<<<<<<
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):
 *                     raise TypeError(
*/
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = (__pyx_t_5 != Py_None);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {

        /* "cupy/_core/_kernel.pyx":587
 *         else:
 *             if p.dtype is not None:
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
*/
        __pyx_t_9 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_15))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_15);
          assert(__pyx_t_9);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_a};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __pyx_t_9 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
          assert(__pyx_t_9);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_10};
          __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
        }
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_15, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 587, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__pyx_t_2)) {

          /* "cupy/_core/_kernel.pyx":588
 *             if p.dtype is not None:
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:
*/
          __pyx_t_15 = NULL;

          /* "cupy/_core/_kernel.pyx":589
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))             # <<<<<<<<<<<<<<
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
*/
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_a), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_9), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_Type_is_mismatched;
          __pyx_t_14[1] = __pyx_t_10;
          __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_14[3] = __pyx_t_5;
          __pyx_t_14[4] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_14[5] = __pyx_t_12;
          __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_9};
            __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_Raise(__pyx_t_1, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(0, 588, __pyx_L1_error)

          /* "cupy/_core/_kernel.pyx":587
 *         else:
 *             if p.dtype is not None:
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
*/
        }

        /* "cupy/_core/_kernel.pyx":586
 *                 unknown_ctype.append(p.ctype)
 *         else:
 *             if p.dtype is not None:             # <<<<<<<<<<<<<<
 *                 if numpy.dtype(a) != numpy.dtype(p.dtype):
 *                     raise TypeError(
*/
        goto __pyx_L19;
      }

      /* "cupy/_core/_kernel.pyx":590
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:             # <<<<<<<<<<<<<<
 *                 t = type_dict[p.ctype]
 *                 if numpy.dtype(t) != numpy.dtype(a):
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_t_1, __pyx_v_type_dict, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 590, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_2) {

        /* "cupy/_core/_kernel.pyx":591
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]             # <<<<<<<<<<<<<<
 *                 if numpy.dtype(t) != numpy.dtype(a):
 *                     raise TypeError(
*/
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_type_dict, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 591, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "cupy/_core/_kernel.pyx":592
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
 *                 if numpy.dtype(t) != numpy.dtype(a):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
*/
        __pyx_t_1 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_t};
          __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_t_1 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_a};
          __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
        }
        __pyx_t_5 = PyObject_RichCompare(__pyx_t_9, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__pyx_t_2)) {

          /* "cupy/_core/_kernel.pyx":593
 *                 t = type_dict[p.ctype]
 *                 if numpy.dtype(t) != numpy.dtype(a):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'Type is mismatched. %s %s %s %s' % (
 *                             p.name, a, t, p.ctype))
*/
          __pyx_t_12 = NULL;

          /* "cupy/_core/_kernel.pyx":595
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
 *                             p.name, a, t, p.ctype))             # <<<<<<<<<<<<<<
 *             else:
 *                 type_dict[p.ctype] = a
*/
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_9), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_a), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_15 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_t), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_13 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_10), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_Type_is_mismatched;
          __pyx_t_16[1] = __pyx_t_1;
          __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[3] = __pyx_t_9;
          __pyx_t_16[4] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[5] = __pyx_t_15;
          __pyx_t_16[6] = __pyx_mstate_global->__pyx_kp_u__4;
          __pyx_t_16[7] = __pyx_t_13;

          /* "cupy/_core/_kernel.pyx":594
 *                 if numpy.dtype(t) != numpy.dtype(a):
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (             # <<<<<<<<<<<<<<
 *                             p.name, a, t, p.ctype))
 *             else:
*/
          __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_16, 8, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 594, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_10};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 593, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_Raise(__pyx_t_5, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __PYX_ERR(0, 593, __pyx_L1_error)

          /* "cupy/_core/_kernel.pyx":592
 *             elif p.ctype in type_dict:
 *                 t = type_dict[p.ctype]
 *                 if numpy.dtype(t) != numpy.dtype(a):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s %s' % (
*/
        }

        /* "cupy/_core/_kernel.pyx":590
 *                     raise TypeError(
 *                         'Type is mismatched. %s %s %s' % (p.name, a, p.dtype))
 *             elif p.ctype in type_dict:             # <<<<<<<<<<<<<<
 *                 t = type_dict[p.ctype]
 *                 if numpy.dtype(t) != numpy.dtype(a):
*/
        goto __pyx_L19;
      }

      /* "cupy/_core/_kernel.pyx":597
 *                             p.name, a, t, p.ctype))
 *             else:
 *                 type_dict[p.ctype] = a             # <<<<<<<<<<<<<<
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
*/
      /*else*/ {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (unlikely((PyDict_SetItem(__pyx_v_type_dict, __pyx_t_5, __pyx_v_a) < 0))) __PYX_ERR(0, 597, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_L19:;
    }
    __pyx_L17:;

    /* "cupy/_core/_kernel.pyx":581
 *     assert len(in_params) == len(in_args_dtype)
 *     unknown_ctype = []  # TODO(leofang): remove this as it's unused?
 *     for p, a in zip(in_params, in_args_dtype):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             if p.dtype is None:
*/
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "cupy/_core/_kernel.pyx":599
 *                 type_dict[p.ctype] = a
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
*/
  { /* enter inner scope */
    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L25_error)
    __Pyx_GOTREF(__pyx_t_8);

    /* "cupy/_core/_kernel.pyx":600
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                       for p in in_params])             # <<<<<<<<<<<<<<
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                        for p in out_params])
*/
    if (unlikely(__pyx_v_in_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 600, __pyx_L25_error)
    }
    __pyx_t_5 = __pyx_v_in_params; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 600, __pyx_L25_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3));
      #else
      __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_3);
      #endif
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 600, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_p, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "cupy/_core/_kernel.pyx":599
 *                 type_dict[p.ctype] = a
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
*/
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 599, __pyx_L25_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_2 = (__pyx_t_12 == Py_None);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_2) {
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 599, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_type_dict, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 599, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_10 = __pyx_t_13;
        __pyx_t_13 = 0;
      } else {
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 599, __pyx_L25_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_10 = __pyx_t_13;
        __pyx_t_13 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 599, __pyx_L25_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "cupy/_core/_kernel.pyx":600
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                       for p in in_params])             # <<<<<<<<<<<<<<
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                        for p in out_params])
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_p); __pyx_8genexpr4__pyx_v_p = 0;
    goto __pyx_L29_exit_scope;
    __pyx_L25_error:;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_p); __pyx_8genexpr4__pyx_v_p = 0;
    goto __pyx_L1_error;
    __pyx_L29_exit_scope:;
  } /* exit inner scope */

  /* "cupy/_core/_kernel.pyx":599
 *                 type_dict[p.ctype] = a
 * 
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
*/
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_in_types = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":601
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                        for p in out_params])
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
*/
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 601, __pyx_L32_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "cupy/_core/_kernel.pyx":602
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                        for p in out_params])             # <<<<<<<<<<<<<<
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
 *     return in_types, out_types, type_map
*/
    if (unlikely(__pyx_v_out_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 602, __pyx_L32_error)
    }
    __pyx_t_8 = __pyx_v_out_params; __Pyx_INCREF(__pyx_t_8);
    __pyx_t_3 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 602, __pyx_L32_error)
        #endif
        if (__pyx_t_3 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_3));
      #else
      __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_3);
      #endif
      ++__pyx_t_3;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 602, __pyx_L32_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_p, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "cupy/_core/_kernel.pyx":601
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                        for p in out_params])
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
*/
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 601, __pyx_L32_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = (__pyx_t_13 == Py_None);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__pyx_t_2) {
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 601, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_type_dict, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 601, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_10 = __pyx_t_12;
        __pyx_t_12 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_p, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 601, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = __pyx_t_12;
        __pyx_t_12 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 601, __pyx_L32_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "cupy/_core/_kernel.pyx":602
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                        for p in out_params])             # <<<<<<<<<<<<<<
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
 *     return in_types, out_types, type_map
*/
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_p); __pyx_8genexpr5__pyx_v_p = 0;
    goto __pyx_L36_exit_scope;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_p); __pyx_8genexpr5__pyx_v_p = 0;
    goto __pyx_L1_error;
    __pyx_L36_exit_scope:;
  } /* exit inner scope */

  /* "cupy/_core/_kernel.pyx":601
 *     in_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                       for p in in_params])
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype             # <<<<<<<<<<<<<<
 *                        for p in out_params])
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
*/
  __pyx_t_8 = PyList_AsTuple(((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_out_types = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "cupy/_core/_kernel.pyx":603
 *     out_types = tuple([type_dict[p.ctype] if p.dtype is None else p.dtype
 *                        for p in out_params])
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))             # <<<<<<<<<<<<<<
 *     return in_types, out_types, type_map
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_10 = __Pyx_PyDict_Items(__pyx_v_type_dict); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PySequence_List(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely((PyList_Sort(__pyx_t_12) < 0))) __PYX_ERR(0, 603, __pyx_L1_error)
  __pyx_t_10 = PyList_AsTuple(__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
    __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 603, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_8);
  }
  __pyx_v_type_map = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "cupy/_core/_kernel.pyx":604
 *                        for p in out_params])
 *     type_map = _TypeMap(tuple(sorted(type_dict.items())))
 *     return in_types, out_types, type_map             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_in_types);
  __Pyx_GIVEREF(__pyx_v_in_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_in_types) != (0)) __PYX_ERR(0, 604, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_out_types);
  __Pyx_GIVEREF(__pyx_v_out_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_out_types) != (0)) __PYX_ERR(0, 604, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_type_map);
  __Pyx_GIVEREF((PyObject *)__pyx_v_type_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_v_type_map)) != (0)) __PYX_ERR(0, 604, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":557
 * 
 * 
 * cdef tuple _decide_params_type_core(             # <<<<<<<<<<<<<<
 *         tuple in_params, tuple out_params, tuple in_args_dtype,
 *         tuple out_args_dtype):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("cupy._core._kernel._decide_params_type_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_type_dict);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_unknown_ctype);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_out_types);
  __Pyx_XDECREF((PyObject *)__pyx_v_type_map);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_p);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":607
 * 
 * 
 * cdef list _broadcast(list args, tuple params, bint use_size, shape_t& shape):             # <<<<<<<<<<<<<<
 *     # `shape` is an output argument
 *     cdef Py_ssize_t i
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__broadcast(PyObject *__pyx_v_args, PyObject *__pyx_v_params, int __pyx_v_use_size, __pyx_t_4cupy_5_core_7_carray_shape_t &__pyx_v_shape) {
  Py_ssize_t __pyx_v_i;
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p = 0;
  int __pyx_v_any_nonraw_array;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_broadcast", 0);

  /* "cupy/_core/_kernel.pyx":611
 *     cdef Py_ssize_t i
 *     cdef ParameterInfo p
 *     cdef bint any_nonraw_array = False             # <<<<<<<<<<<<<<
 * 
 *     # Collect non-raw arrays
*/
  __pyx_v_any_nonraw_array = 0;

  /* "cupy/_core/_kernel.pyx":614
 * 
 *     # Collect non-raw arrays
 *     value = []             # <<<<<<<<<<<<<<
 *     for i, a in enumerate(args):
 *         p = params[i]
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":615
 *     # Collect non-raw arrays
 *     value = []
 *     for i, a in enumerate(args):             # <<<<<<<<<<<<<<
 *         p = params[i]
 *         if not p.raw and isinstance(a, _ndarray_base):
*/
  __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 615, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);

    /* "cupy/_core/_kernel.pyx":616
 *     value = []
 *     for i, a in enumerate(args):
 *         p = params[i]             # <<<<<<<<<<<<<<
 *         if not p.raw and isinstance(a, _ndarray_base):
 *             # Non-raw array
*/
    if (unlikely(__pyx_v_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 616, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_params, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":617
 *     for i, a in enumerate(args):
 *         p = params[i]
 *         if not p.raw and isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             # Non-raw array
 *             any_nonraw_array = True
*/
    __pyx_t_6 = (!__pyx_v_p->raw);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":619
 *         if not p.raw and isinstance(a, _ndarray_base):
 *             # Non-raw array
 *             any_nonraw_array = True             # <<<<<<<<<<<<<<
 *             value.append(a)
 *         else:
*/
      __pyx_v_any_nonraw_array = 1;

      /* "cupy/_core/_kernel.pyx":620
 *             # Non-raw array
 *             any_nonraw_array = True
 *             value.append(a)             # <<<<<<<<<<<<<<
 *         else:
 *             value.append(None)
*/
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_value, __pyx_v_a); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 620, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":617
 *     for i, a in enumerate(args):
 *         p = params[i]
 *         if not p.raw and isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             # Non-raw array
 *             any_nonraw_array = True
*/
      goto __pyx_L5;
    }

    /* "cupy/_core/_kernel.pyx":622
 *             value.append(a)
 *         else:
 *             value.append(None)             # <<<<<<<<<<<<<<
 * 
 *     if use_size:
*/
    /*else*/ {
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_value, Py_None); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 622, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "cupy/_core/_kernel.pyx":615
 *     # Collect non-raw arrays
 *     value = []
 *     for i, a in enumerate(args):             # <<<<<<<<<<<<<<
 *         p = params[i]
 *         if not p.raw and isinstance(a, _ndarray_base):
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":624
 *             value.append(None)
 * 
 *     if use_size:             # <<<<<<<<<<<<<<
 *         if any_nonraw_array:
 *             raise ValueError('Specified \'size\' can be used only '
*/
  if (__pyx_v_use_size) {

    /* "cupy/_core/_kernel.pyx":625
 * 
 *     if use_size:
 *         if any_nonraw_array:             # <<<<<<<<<<<<<<
 *             raise ValueError('Specified \'size\' can be used only '
 *                              'if all of the ndarray are \'raw\'.')
*/
    if (unlikely(__pyx_v_any_nonraw_array)) {

      /* "cupy/_core/_kernel.pyx":626
 *     if use_size:
 *         if any_nonraw_array:
 *             raise ValueError('Specified \'size\' can be used only '             # <<<<<<<<<<<<<<
 *                              'if all of the ndarray are \'raw\'.')
 *     else:
*/
      __pyx_t_4 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Specified_size_can_be_used_only};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 626, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":625
 * 
 *     if use_size:
 *         if any_nonraw_array:             # <<<<<<<<<<<<<<
 *             raise ValueError('Specified \'size\' can be used only '
 *                              'if all of the ndarray are \'raw\'.')
*/
    }

    /* "cupy/_core/_kernel.pyx":624
 *             value.append(None)
 * 
 *     if use_size:             # <<<<<<<<<<<<<<
 *         if any_nonraw_array:
 *             raise ValueError('Specified \'size\' can be used only '
*/
    goto __pyx_L9;
  }

  /* "cupy/_core/_kernel.pyx":629
 *                              'if all of the ndarray are \'raw\'.')
 *     else:
 *         if not any_nonraw_array:             # <<<<<<<<<<<<<<
 *             raise ValueError('Loop size is undecided.')
 * 
*/
  /*else*/ {
    __pyx_t_5 = (!__pyx_v_any_nonraw_array);
    if (unlikely(__pyx_t_5)) {

      /* "cupy/_core/_kernel.pyx":630
 *     else:
 *         if not any_nonraw_array:
 *             raise ValueError('Loop size is undecided.')             # <<<<<<<<<<<<<<
 * 
 *     # Perform broadcast.
*/
      __pyx_t_4 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Loop_size_is_undecided};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 630, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":629
 *                              'if all of the ndarray are \'raw\'.')
 *     else:
 *         if not any_nonraw_array:             # <<<<<<<<<<<<<<
 *             raise ValueError('Loop size is undecided.')
 * 
*/
    }
  }
  __pyx_L9:;

  /* "cupy/_core/_kernel.pyx":634
 *     # Perform broadcast.
 *     # Note that arrays in `value` are replaced with broadcasted ones.
 *     internal._broadcast_core(value, shape)             # <<<<<<<<<<<<<<
 * 
 *     # Restore raw arrays and scalars from the original list.
*/
  __pyx_t_1 = __pyx_f_4cupy_5_core_8internal__broadcast_core(__pyx_v_value, __pyx_v_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":637
 * 
 *     # Restore raw arrays and scalars from the original list.
 *     for i, a in enumerate(value):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             value[i] = args[i]
*/
  __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 637, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);

    /* "cupy/_core/_kernel.pyx":638
 *     # Restore raw arrays and scalars from the original list.
 *     for i, a in enumerate(value):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             value[i] = args[i]
 *     return value
*/
    __pyx_t_5 = (__pyx_v_a == Py_None);
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":639
 *     for i, a in enumerate(value):
 *         if a is None:
 *             value[i] = args[i]             # <<<<<<<<<<<<<<
 *     return value
 * 
*/
      if (unlikely(__pyx_v_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 639, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_args, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely((__Pyx_SetItemInt(__pyx_v_value, __pyx_v_i, __pyx_t_4, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 639, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":638
 *     # Restore raw arrays and scalars from the original list.
 *     for i, a in enumerate(value):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             value[i] = args[i]
 *     return value
*/
    }

    /* "cupy/_core/_kernel.pyx":637
 * 
 *     # Restore raw arrays and scalars from the original list.
 *     for i, a in enumerate(value):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             value[i] = args[i]
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":640
 *         if a is None:
 *             value[i] = args[i]
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":607
 * 
 * 
 * cdef list _broadcast(list args, tuple params, bint use_size, shape_t& shape):             # <<<<<<<<<<<<<<
 *     # `shape` is an output argument
 *     cdef Py_ssize_t i
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._broadcast", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":646
 * cdef _numpy_result_type = numpy.result_type
 * 
 * cdef list _get_out_args_from_optionals(             # <<<<<<<<<<<<<<
 *     subtype, list out_args, tuple out_types, const shape_t& out_shape, casting,
 *     obj
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_out_args_from_optionals(PyObject *__pyx_v_subtype, PyObject *__pyx_v_out_args, PyObject *__pyx_v_out_types, __pyx_t_4cupy_5_core_7_carray_shape_t const &__pyx_v_out_shape, PyObject *__pyx_v_casting, PyObject *__pyx_v_obj) {
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_out_type = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  size_t __pyx_t_9;
  struct __pyx_opt_args_4cupy_5_core_6_dtype__raise_if_invalid_cast __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_out_args_from_optionals", 0);

  /* "cupy/_core/_kernel.pyx":652
 *     cdef _ndarray_base arr
 * 
 *     while len(out_args) < len(out_types):             # <<<<<<<<<<<<<<
 *         out_args.append(None)
 * 
*/
  while (1) {
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 652, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_out_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 652, __pyx_L1_error)
    if (unlikely(__pyx_v_out_types == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 652, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_out_types); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 652, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_1 < __pyx_t_2);
    if (!__pyx_t_3) break;

    /* "cupy/_core/_kernel.pyx":653
 * 
 *     while len(out_args) < len(out_types):
 *         out_args.append(None)             # <<<<<<<<<<<<<<
 * 
 *     for i, a in enumerate(out_args):
*/
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 653, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_out_args, Py_None); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 653, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":655
 *         out_args.append(None)
 * 
 *     for i, a in enumerate(out_args):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             out_args[i] = _ndarray_init(
*/
  __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_v_out_args; __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 655, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);

    /* "cupy/_core/_kernel.pyx":656
 * 
 *     for i, a in enumerate(out_args):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             out_args[i] = _ndarray_init(
 *                 subtype, out_shape, out_types[i], obj)
*/
    __pyx_t_3 = (__pyx_v_a == Py_None);
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":658
 *         if a is None:
 *             out_args[i] = _ndarray_init(
 *                 subtype, out_shape, out_types[i], obj)             # <<<<<<<<<<<<<<
 *             continue
 * 
*/
      if (unlikely(__pyx_v_out_types == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 658, __pyx_L1_error)
      }
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_out_types, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "cupy/_core/_kernel.pyx":657
 *     for i, a in enumerate(out_args):
 *         if a is None:
 *             out_args[i] = _ndarray_init(             # <<<<<<<<<<<<<<
 *                 subtype, out_shape, out_types[i], obj)
 *             continue
*/
      __pyx_t_7 = ((PyObject *)__pyx_f_4cupy_5_core_4core__ndarray_init(__pyx_v_subtype, __pyx_v_out_shape, __pyx_t_6, __pyx_v_obj)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 657, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__pyx_v_out_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 657, __pyx_L1_error)
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_out_args, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument) < 0))) __PYX_ERR(0, 657, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cupy/_core/_kernel.pyx":659
 *             out_args[i] = _ndarray_init(
 *                 subtype, out_shape, out_types[i], obj)
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(a, _ndarray_base):
*/
      goto __pyx_L5_continue;

      /* "cupy/_core/_kernel.pyx":656
 * 
 *     for i, a in enumerate(out_args):
 *         if a is None:             # <<<<<<<<<<<<<<
 *             out_args[i] = _ndarray_init(
 *                 subtype, out_shape, out_types[i], obj)
*/
    }

    /* "cupy/_core/_kernel.pyx":661
 *             continue
 * 
 *         if not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
*/
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __pyx_t_8 = (!__pyx_t_3);
    if (unlikely(__pyx_t_8)) {

      /* "cupy/_core/_kernel.pyx":662
 * 
 *         if not isinstance(a, _ndarray_base):
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
*/
      __pyx_t_6 = NULL;
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Output_arguments_type_must_be_cu};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 662, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":661
 *             continue
 * 
 *         if not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
*/
    }

    /* "cupy/_core/_kernel.pyx":664
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a             # <<<<<<<<<<<<<<
 *         if not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')
*/
    __pyx_t_7 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_7);
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "cupy/_core/_kernel.pyx":665
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
 *         if not internal.vector_equal(arr._shape, out_shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('Out shape is mismatched')
 *         out_type = get_dtype(out_types[i])
*/
    __pyx_t_8 = (!__pyx_f_4cupy_5_core_8internal_vector_equal(__pyx_v_arr->_shape, __pyx_v_out_shape, 0));
    if (unlikely(__pyx_t_8)) {

      /* "cupy/_core/_kernel.pyx":666
 *         arr = a
 *         if not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')             # <<<<<<<<<<<<<<
 *         out_type = get_dtype(out_types[i])
 * 
*/
      __pyx_t_6 = NULL;
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Out_shape_is_mismatched};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 666, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 666, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":665
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
 *         if not internal.vector_equal(arr._shape, out_shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('Out shape is mismatched')
 *         out_type = get_dtype(out_types[i])
*/
    }

    /* "cupy/_core/_kernel.pyx":667
 *         if not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')
 *         out_type = get_dtype(out_types[i])             # <<<<<<<<<<<<<<
 * 
 *         _raise_if_invalid_cast(out_type, arr.dtype, casting, "output operand")
*/
    if (unlikely(__pyx_v_out_types == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 667, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_out_types, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_t_7, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_out_type, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":669
 *         out_type = get_dtype(out_types[i])
 * 
 *         _raise_if_invalid_cast(out_type, arr.dtype, casting, "output operand")             # <<<<<<<<<<<<<<
 *     return out_args
 * 
*/
    __pyx_t_6 = __pyx_v_arr->dtype;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = __pyx_v_casting;
    __Pyx_INCREF(__pyx_t_7);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_7))) __PYX_ERR(0, 669, __pyx_L1_error)
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.argname = __pyx_mstate_global->__pyx_kp_u_output_operand;
    __pyx_f_4cupy_5_core_6_dtype__raise_if_invalid_cast(__pyx_v_out_type, __pyx_t_6, ((PyObject*)__pyx_t_7), 0, &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "cupy/_core/_kernel.pyx":655
 *         out_args.append(None)
 * 
 *     for i, a in enumerate(out_args):             # <<<<<<<<<<<<<<
 *         if a is None:
 *             out_args[i] = _ndarray_init(
*/
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":670
 * 
 *         _raise_if_invalid_cast(out_type, arr.dtype, casting, "output operand")
 *     return out_args             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out_args);
  __pyx_r = __pyx_v_out_args;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":646
 * cdef _numpy_result_type = numpy.result_type
 * 
 * cdef list _get_out_args_from_optionals(             # <<<<<<<<<<<<<<
 *     subtype, list out_args, tuple out_types, const shape_t& out_shape, casting,
 *     obj
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel._get_out_args_from_optionals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_out_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":673
 * 
 * 
 * cdef _copy_in_args_if_needed(list in_args, list out_args):             # <<<<<<<<<<<<<<
 *     # `in_args` is an input and output argument
 *     cdef _ndarray_base inp, out
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__copy_in_args_if_needed(PyObject *__pyx_v_in_args, PyObject *__pyx_v_out_args) {
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_inp = 0;
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_out = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_copy_in_args_if_needed", 0);

  /* "cupy/_core/_kernel.pyx":676
 *     # `in_args` is an input and output argument
 *     cdef _ndarray_base inp, out
 *     for i in range(len(in_args)):             # <<<<<<<<<<<<<<
 *         a = in_args[i]
 *         if isinstance(a, _ndarray_base):
*/
  if (unlikely(__pyx_v_in_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 676, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_in_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 676, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "cupy/_core/_kernel.pyx":677
 *     cdef _ndarray_base inp, out
 *     for i in range(len(in_args)):
 *         a = in_args[i]             # <<<<<<<<<<<<<<
 *         if isinstance(a, _ndarray_base):
 *             inp = a
*/
    if (unlikely(__pyx_v_in_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 677, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_in_args, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":678
 *     for i in range(len(in_args)):
 *         a = in_args[i]
 *         if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             inp = a
 *             for out in out_args:
*/
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":679
 *         a = in_args[i]
 *         if isinstance(a, _ndarray_base):
 *             inp = a             # <<<<<<<<<<<<<<
 *             for out in out_args:
 *                 if inp is not out and may_share_bounds(inp, out):
*/
      __pyx_t_4 = __pyx_v_a;
      __Pyx_INCREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_inp, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":680
 *         if isinstance(a, _ndarray_base):
 *             inp = a
 *             for out in out_args:             # <<<<<<<<<<<<<<
 *                 if inp is not out and may_share_bounds(inp, out):
 *                     in_args[i] = inp.copy()
*/
      if (unlikely(__pyx_v_out_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 680, __pyx_L1_error)
      }
      __pyx_t_4 = __pyx_v_out_args; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 680, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 680, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 680, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_out, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "cupy/_core/_kernel.pyx":681
 *             inp = a
 *             for out in out_args:
 *                 if inp is not out and may_share_bounds(inp, out):             # <<<<<<<<<<<<<<
 *                     in_args[i] = inp.copy()
 *                     break
*/
        __pyx_t_8 = (__pyx_v_inp != __pyx_v_out);
        if (__pyx_t_8) {
        } else {
          __pyx_t_5 = __pyx_t_8;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_8 = __pyx_f_4cupy_5_core_13_memory_range_may_share_bounds(__pyx_v_inp, __pyx_v_out, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L1_error)
        __pyx_t_5 = __pyx_t_8;
        __pyx_L9_bool_binop_done:;
        if (__pyx_t_5) {

          /* "cupy/_core/_kernel.pyx":682
 *             for out in out_args:
 *                 if inp is not out and may_share_bounds(inp, out):
 *                     in_args[i] = inp.copy()             # <<<<<<<<<<<<<<
 *                     break
 * 
*/
          __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base *)__pyx_v_inp->__pyx_vtab)->copy(__pyx_v_inp, 0, NULL)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 682, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (unlikely(__pyx_v_in_args == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 682, __pyx_L1_error)
          }
          if (unlikely((__Pyx_SetItemInt(__pyx_v_in_args, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument) < 0))) __PYX_ERR(0, 682, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cupy/_core/_kernel.pyx":683
 *                 if inp is not out and may_share_bounds(inp, out):
 *                     in_args[i] = inp.copy()
 *                     break             # <<<<<<<<<<<<<<
 * 
 * 
*/
          goto __pyx_L7_break;

          /* "cupy/_core/_kernel.pyx":681
 *             inp = a
 *             for out in out_args:
 *                 if inp is not out and may_share_bounds(inp, out):             # <<<<<<<<<<<<<<
 *                     in_args[i] = inp.copy()
 *                     break
*/
        }

        /* "cupy/_core/_kernel.pyx":680
 *         if isinstance(a, _ndarray_base):
 *             inp = a
 *             for out in out_args:             # <<<<<<<<<<<<<<
 *                 if inp is not out and may_share_bounds(inp, out):
 *                     in_args[i] = inp.copy()
*/
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_for_end;
      __pyx_L7_break:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_for_end;
      __pyx_L11_for_end:;

      /* "cupy/_core/_kernel.pyx":678
 *     for i in range(len(in_args)):
 *         a = in_args[i]
 *         if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             inp = a
 *             for out in out_args:
*/
    }
  }

  /* "cupy/_core/_kernel.pyx":673
 * 
 * 
 * cdef _copy_in_args_if_needed(list in_args, list out_args):             # <<<<<<<<<<<<<<
 *     # `in_args` is an input and output argument
 *     cdef _ndarray_base inp, out
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel._copy_in_args_if_needed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_inp);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":686
 * 
 * 
 * cdef list _get_out_args_with_params(             # <<<<<<<<<<<<<<
 *         list out_args, tuple out_types, const shape_t& out_shape,
 *         tuple out_params, bint is_size_specified):
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel__get_out_args_with_params(PyObject *__pyx_v_out_args, PyObject *__pyx_v_out_types, __pyx_t_4cupy_5_core_7_carray_shape_t const &__pyx_v_out_shape, PyObject *__pyx_v_out_params, int __pyx_v_is_size_specified) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v_p = 0;
  struct __pyx_obj_4cupy_5_core_4core__ndarray_base *__pyx_v_arr = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_8genexpr6__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_out_args_with_params", 0);

  /* "cupy/_core/_kernel.pyx":691
 *     cdef ParameterInfo p
 *     cdef _ndarray_base arr
 *     if not out_args:             # <<<<<<<<<<<<<<
 *         for p in out_params:
 *             if p.raw and not is_size_specified:
*/
  if (__pyx_v_out_args == Py_None) __pyx_t_1 = 0;
  else
  {
    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_out_args);
    if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 691, __pyx_L1_error)
    __pyx_t_1 = (__pyx_temp != 0);
  }

  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":692
 *     cdef _ndarray_base arr
 *     if not out_args:
 *         for p in out_params:             # <<<<<<<<<<<<<<
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')
*/
    if (unlikely(__pyx_v_out_params == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 692, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_v_out_params; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 692, __pyx_L1_error)
        #endif
        if (__pyx_t_4 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4));
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
      #endif
      ++__pyx_t_4;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 692, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 692, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":693
 *     if not out_args:
 *         for p in out_params:
 *             if p.raw and not is_size_specified:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(
*/
      if (__pyx_v_p->raw) {
      } else {
        __pyx_t_2 = __pyx_v_p->raw;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_1 = (!__pyx_v_is_size_specified);
      __pyx_t_2 = __pyx_t_1;
      __pyx_L7_bool_binop_done:;
      if (unlikely(__pyx_t_2)) {

        /* "cupy/_core/_kernel.pyx":694
 *         for p in out_params:
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')             # <<<<<<<<<<<<<<
 *         return [_ndarray_init(
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
*/
        __pyx_t_6 = NULL;
        __pyx_t_7 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Output_array_size_is_Undecided};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 694, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":693
 *     if not out_args:
 *         for p in out_params:
 *             if p.raw and not is_size_specified:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(
*/
      }

      /* "cupy/_core/_kernel.pyx":692
 *     cdef _ndarray_base arr
 *     if not out_args:
 *         for p in out_params:             # <<<<<<<<<<<<<<
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":695
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(             # <<<<<<<<<<<<<<
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 695, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "cupy/_core/_kernel.pyx":696
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(
 *             cupy.ndarray, out_shape, t, None) for t in out_types]             # <<<<<<<<<<<<<<
 * 
 *     for i, p in enumerate(out_params):
*/
      if (unlikely(__pyx_v_out_types == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 696, __pyx_L12_error)
      }
      __pyx_t_5 = __pyx_v_out_types; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 696, __pyx_L12_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4));
        #else
        __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_4);
        #endif
        ++__pyx_t_4;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 696, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_t, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "cupy/_core/_kernel.pyx":695
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(             # <<<<<<<<<<<<<<
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
 * 
*/
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_cupy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 696, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "cupy/_core/_kernel.pyx":696
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(
 *             cupy.ndarray, out_shape, t, None) for t in out_types]             # <<<<<<<<<<<<<<
 * 
 *     for i, p in enumerate(out_params):
*/
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cupy/_core/_kernel.pyx":695
 *             if p.raw and not is_size_specified:
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(             # <<<<<<<<<<<<<<
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
 * 
*/
        __pyx_t_6 = ((PyObject *)__pyx_f_4cupy_5_core_4core__ndarray_init(__pyx_t_8, __pyx_v_out_shape, __pyx_8genexpr6__pyx_v_t, Py_None)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 695, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 695, __pyx_L12_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "cupy/_core/_kernel.pyx":696
 *                 raise ValueError('Output array size is Undecided')
 *         return [_ndarray_init(
 *             cupy.ndarray, out_shape, t, None) for t in out_types]             # <<<<<<<<<<<<<<
 * 
 *     for i, p in enumerate(out_params):
*/
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_t); __pyx_8genexpr6__pyx_v_t = 0;
      goto __pyx_L16_exit_scope;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_t); __pyx_8genexpr6__pyx_v_t = 0;
      goto __pyx_L1_error;
      __pyx_L16_exit_scope:;
    } /* exit inner scope */
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":691
 *     cdef ParameterInfo p
 *     cdef _ndarray_base arr
 *     if not out_args:             # <<<<<<<<<<<<<<
 *         for p in out_params:
 *             if p.raw and not is_size_specified:
*/
  }

  /* "cupy/_core/_kernel.pyx":698
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
 * 
 *     for i, p in enumerate(out_params):             # <<<<<<<<<<<<<<
 *         a = out_args[i]
 *         if not isinstance(a, _ndarray_base):
*/
  __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_v_out_params; __Pyx_INCREF(__pyx_t_3);
  __pyx_t_9 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 698, __pyx_L1_error)
      #endif
      if (__pyx_t_9 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9));
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_9);
    #endif
    ++__pyx_t_9;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo))))) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_v_i = __pyx_t_4;
    __pyx_t_4 = (__pyx_t_4 + 1);

    /* "cupy/_core/_kernel.pyx":699
 * 
 *     for i, p in enumerate(out_params):
 *         a = out_args[i]             # <<<<<<<<<<<<<<
 *         if not isinstance(a, _ndarray_base):
 *             raise TypeError(
*/
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 699, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_out_args, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":700
 *     for i, p in enumerate(out_params):
 *         a = out_args[i]
 *         if not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
*/
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __pyx_t_1 = (!__pyx_t_2);
    if (unlikely(__pyx_t_1)) {

      /* "cupy/_core/_kernel.pyx":701
 *         a = out_args[i]
 *         if not isinstance(a, _ndarray_base):
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
*/
      __pyx_t_6 = NULL;
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Output_arguments_type_must_be_cu};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 701, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":700
 *     for i, p in enumerate(out_params):
 *         a = out_args[i]
 *         if not isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
*/
    }

    /* "cupy/_core/_kernel.pyx":703
 *             raise TypeError(
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a             # <<<<<<<<<<<<<<
 *         if not p.raw and not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')
*/
    __pyx_t_5 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base))))) __PYX_ERR(0, 703, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":704
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
 *         if not p.raw and not internal.vector_equal(arr._shape, out_shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('Out shape is mismatched')
 *     return out_args
*/
    __pyx_t_2 = (!__pyx_v_p->raw);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L21_bool_binop_done;
    }
    __pyx_t_2 = (!__pyx_f_4cupy_5_core_8internal_vector_equal(__pyx_v_arr->_shape, __pyx_v_out_shape, 0));
    __pyx_t_1 = __pyx_t_2;
    __pyx_L21_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "cupy/_core/_kernel.pyx":705
 *         arr = a
 *         if not p.raw and not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')             # <<<<<<<<<<<<<<
 *     return out_args
 * 
*/
      __pyx_t_6 = NULL;
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Out_shape_is_mismatched};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 705, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":704
 *                 'Output arguments type must be cupy.ndarray')
 *         arr = a
 *         if not p.raw and not internal.vector_equal(arr._shape, out_shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('Out shape is mismatched')
 *     return out_args
*/
    }

    /* "cupy/_core/_kernel.pyx":698
 *             cupy.ndarray, out_shape, t, None) for t in out_types]
 * 
 *     for i, p in enumerate(out_params):             # <<<<<<<<<<<<<<
 *         a = out_args[i]
 *         if not isinstance(a, _ndarray_base):
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":706
 *         if not p.raw and not internal.vector_equal(arr._shape, out_shape):
 *             raise ValueError('Out shape is mismatched')
 *     return out_args             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out_args);
  __pyx_r = __pyx_v_out_args;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":686
 * 
 * 
 * cdef list _get_out_args_with_params(             # <<<<<<<<<<<<<<
 *         list out_args, tuple out_types, const shape_t& out_shape,
 *         tuple out_params, bint is_size_specified):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._get_out_args_with_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":709
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel_code(
 *         tuple arginfos, _TypeMap type_map,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13_get_elementwise_kernel_code(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_12_get_elementwise_kernel_code, "_get_elementwise_kernel_code(tuple arginfos, _TypeMap type_map, tuple params, str operation, str name, str preamble, str loop_prep='', str after_loop='', tuple options=())");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_13_get_elementwise_kernel_code = {"_get_elementwise_kernel_code", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_13_get_elementwise_kernel_code, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_12_get_elementwise_kernel_code};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_13_get_elementwise_kernel_code(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_arginfos = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map = 0;
  PyObject *__pyx_v_params = 0;
  PyObject *__pyx_v_operation = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_preamble = 0;
  PyObject *__pyx_v_loop_prep = 0;
  PyObject *__pyx_v_after_loop = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_elementwise_kernel_code (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arginfos,&__pyx_mstate_global->__pyx_n_u_type_map,&__pyx_mstate_global->__pyx_n_u_params,&__pyx_mstate_global->__pyx_n_u_operation,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_preamble,&__pyx_mstate_global->__pyx_n_u_loop_prep,&__pyx_mstate_global->__pyx_n_u_after_loop,&__pyx_mstate_global->__pyx_n_u_options,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 709, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_elementwise_kernel_code", 0) < (0)) __PYX_ERR(0, 709, __pyx_L3_error)
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":713
 *         tuple arginfos, _TypeMap type_map,
 *         tuple params, str operation, str name,
 *         str preamble, str loop_prep='', str after_loop='', tuple options=()):             # <<<<<<<<<<<<<<
 *     cdef _ArgInfo arginfo
 * 
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_empty_tuple));
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel_code", 0, 6, 9, i); __PYX_ERR(0, 709, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 709, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 709, __pyx_L3_error)
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 709, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 709, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 709, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 709, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 709, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_empty_tuple));
    }
    __pyx_v_arginfos = ((PyObject*)values[0]);
    __pyx_v_type_map = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)values[1]);
    __pyx_v_params = ((PyObject*)values[2]);
    __pyx_v_operation = ((PyObject*)values[3]);
    __pyx_v_name = ((PyObject*)values[4]);
    __pyx_v_preamble = ((PyObject*)values[5]);
    __pyx_v_loop_prep = ((PyObject*)values[6]);
    __pyx_v_after_loop = ((PyObject*)values[7]);
    __pyx_v_options = ((PyObject*)values[8]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel_code", 0, 6, 9, __pyx_nargs); __PYX_ERR(0, 709, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._get_elementwise_kernel_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arginfos), (&PyTuple_Type), 1, "arginfos", 1))) __PYX_ERR(0, 711, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_type_map), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, 1, "type_map", 0))) __PYX_ERR(0, 711, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_params), (&PyTuple_Type), 1, "params", 1))) __PYX_ERR(0, 712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_operation), (&PyUnicode_Type), 1, "operation", 1))) __PYX_ERR(0, 712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 712, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_preamble), (&PyUnicode_Type), 1, "preamble", 1))) __PYX_ERR(0, 713, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop_prep), (&PyUnicode_Type), 1, "loop_prep", 1))) __PYX_ERR(0, 713, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_after_loop), (&PyUnicode_Type), 1, "after_loop", 1))) __PYX_ERR(0, 713, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), (&PyTuple_Type), 1, "options", 1))) __PYX_ERR(0, 713, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_12_get_elementwise_kernel_code(__pyx_self, __pyx_v_arginfos, __pyx_v_type_map, __pyx_v_params, __pyx_v_operation, __pyx_v_name, __pyx_v_preamble, __pyx_v_loop_prep, __pyx_v_after_loop, __pyx_v_options);

  /* "cupy/_core/_kernel.pyx":709
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel_code(
 *         tuple arginfos, _TypeMap type_map,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_12_get_elementwise_kernel_code(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_after_loop, CYTHON_UNUSED PyObject *__pyx_v_options) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_arginfo = 0;
  PyObject *__pyx_v_op = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_fmt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_elementwise_kernel_code", 0);
  __Pyx_INCREF(__pyx_v_operation);

  /* "cupy/_core/_kernel.pyx":716
 *     cdef _ArgInfo arginfo
 * 
 *     op = []             # <<<<<<<<<<<<<<
 *     for p, arginfo in zip(params, arginfos):
 *         if arginfo.is_ndarray() and not p.raw:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":717
 * 
 *     op = []
 *     for p, arginfo in zip(params, arginfos):             # <<<<<<<<<<<<<<
 *         if arginfo.is_ndarray() and not p.raw:
 *             if p.is_const:
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_params, __pyx_v_arginfos};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 717, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_4;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 717, __pyx_L1_error)
          #endif
          if (__pyx_t_4 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4);
        #endif
        ++__pyx_t_4;
      }
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 717, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 717, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
      } else {
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
      }
      #else
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 717, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 717, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_arginfo, ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "cupy/_core/_kernel.pyx":718
 *     op = []
 *     for p, arginfo in zip(params, arginfos):
 *         if arginfo.is_ndarray() and not p.raw:             # <<<<<<<<<<<<<<
 *             if p.is_const:
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
*/
    __pyx_t_11 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->is_ndarray(__pyx_v_arginfo);
    if (__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_raw_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 718, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = (!__pyx_t_11);
    __pyx_t_10 = __pyx_t_12;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_10) {

      /* "cupy/_core/_kernel.pyx":719
 *     for p, arginfo in zip(params, arginfos):
 *         if arginfo.is_ndarray() and not p.raw:
 *             if p.is_const:             # <<<<<<<<<<<<<<
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
 *             else:
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_is_const); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_10) {

        /* "cupy/_core/_kernel.pyx":720
 *         if arginfo.is_ndarray() and not p.raw:
 *             if p.is_const:
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'             # <<<<<<<<<<<<<<
 *             else:
 *                 fmt = '{t} &{n} = _raw_{n}[_ind.get()];'
*/
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_const_t_n__raw__n__ind_get);
        __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_mstate_global->__pyx_kp_u_const_t_n__raw__n__ind_get);

        /* "cupy/_core/_kernel.pyx":719
 *     for p, arginfo in zip(params, arginfos):
 *         if arginfo.is_ndarray() and not p.raw:
 *             if p.is_const:             # <<<<<<<<<<<<<<
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
 *             else:
*/
        goto __pyx_L10;
      }

      /* "cupy/_core/_kernel.pyx":722
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
 *             else:
 *                 fmt = '{t} &{n} = _raw_{n}[_ind.get()];'             # <<<<<<<<<<<<<<
 *             op.append(fmt.format(t=p.ctype, n=p.name))
 *     op.append(operation)
*/
      /*else*/ {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_t_n__raw__n__ind_get);
        __Pyx_XDECREF_SET(__pyx_v_fmt, __pyx_mstate_global->__pyx_kp_u_t_n__raw__n__ind_get);
      }
      __pyx_L10:;

      /* "cupy/_core/_kernel.pyx":723
 *             else:
 *                 fmt = '{t} &{n} = _raw_{n}[_ind.get()];'
 *             op.append(fmt.format(t=p.ctype, n=p.name))             # <<<<<<<<<<<<<<
 *     op.append(operation)
 *     operation = '\n'.join(op)
*/
      __pyx_t_7 = __pyx_v_fmt;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_ctype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, NULL};
        __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t, __pyx_t_6, __pyx_t_13, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 723, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n, __pyx_t_8, __pyx_t_13, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 723, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_op, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cupy/_core/_kernel.pyx":718
 *     op = []
 *     for p, arginfo in zip(params, arginfos):
 *         if arginfo.is_ndarray() and not p.raw:             # <<<<<<<<<<<<<<
 *             if p.is_const:
 *                 fmt = 'const {t} &{n} = _raw_{n}[_ind.get()];'
*/
    }

    /* "cupy/_core/_kernel.pyx":717
 * 
 *     op = []
 *     for p, arginfo in zip(params, arginfos):             # <<<<<<<<<<<<<<
 *         if arginfo.is_ndarray() and not p.raw:
 *             if p.is_const:
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":724
 *                 fmt = '{t} &{n} = _raw_{n}[_ind.get()];'
 *             op.append(fmt.format(t=p.ctype, n=p.name))
 *     op.append(operation)             # <<<<<<<<<<<<<<
 *     operation = '\n'.join(op)
 *     return _get_simple_elementwise_kernel_code(
*/
  __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_op, __pyx_v_operation); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 724, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":725
 *             op.append(fmt.format(t=p.ctype, n=p.name))
 *     op.append(operation)
 *     operation = '\n'.join(op)             # <<<<<<<<<<<<<<
 *     return _get_simple_elementwise_kernel_code(
 *         params, arginfos, operation, name, type_map,
*/
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__10, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_operation, ((PyObject*)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":726
 *     op.append(operation)
 *     operation = '\n'.join(op)
 *     return _get_simple_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         params, arginfos, operation, name, type_map,
 *         preamble, loop_prep, after_loop)
*/
  __Pyx_XDECREF(__pyx_r);

  /* "cupy/_core/_kernel.pyx":728
 *     return _get_simple_elementwise_kernel_code(
 *         params, arginfos, operation, name, type_map,
 *         preamble, loop_prep, after_loop)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_15.__pyx_n = 2;
  __pyx_t_15.loop_prep = __pyx_v_loop_prep;
  __pyx_t_15.after_loop = __pyx_v_after_loop;
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_code(__pyx_v_params, __pyx_v_arginfos, __pyx_v_operation, __pyx_v_name, __pyx_v_type_map, __pyx_v_preamble, &__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":709
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel_code(
 *         tuple arginfos, _TypeMap type_map,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("cupy._core._kernel._get_elementwise_kernel_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arginfo);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XDECREF(__pyx_v_operation);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":731
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel(
 *         tuple arginfos, _TypeMap type_map,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_15_get_elementwise_kernel(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_14_get_elementwise_kernel, "_get_elementwise_kernel(tuple arginfos, _TypeMap type_map, tuple params, str operation, str name, str preamble, str loop_prep='', str after_loop='', tuple options=())");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_15_get_elementwise_kernel = {"_get_elementwise_kernel", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_15_get_elementwise_kernel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_14_get_elementwise_kernel};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_15_get_elementwise_kernel(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_arginfos = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map = 0;
  PyObject *__pyx_v_params = 0;
  PyObject *__pyx_v_operation = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_preamble = 0;
  PyObject *__pyx_v_loop_prep = 0;
  PyObject *__pyx_v_after_loop = 0;
  PyObject *__pyx_v_options = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_elementwise_kernel (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arginfos,&__pyx_mstate_global->__pyx_n_u_type_map,&__pyx_mstate_global->__pyx_n_u_params,&__pyx_mstate_global->__pyx_n_u_operation,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_preamble,&__pyx_mstate_global->__pyx_n_u_loop_prep,&__pyx_mstate_global->__pyx_n_u_after_loop,&__pyx_mstate_global->__pyx_n_u_options,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 731, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_elementwise_kernel", 0) < (0)) __PYX_ERR(0, 731, __pyx_L3_error)
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":735
 *         tuple arginfos, _TypeMap type_map,
 *         tuple params, str operation, str name,
 *         str preamble, str loop_prep='', str after_loop='', tuple options=()):             # <<<<<<<<<<<<<<
 *     cdef str code = _get_elementwise_kernel_code(
 *         arginfos, type_map, params, operation, name, preamble, loop_prep,
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_empty_tuple));
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel", 0, 6, 9, i); __PYX_ERR(0, 731, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 731, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 731, __pyx_L3_error)
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 731, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 731, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 731, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 731, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 731, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject*)__pyx_mstate_global->__pyx_empty_tuple));
    }
    __pyx_v_arginfos = ((PyObject*)values[0]);
    __pyx_v_type_map = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)values[1]);
    __pyx_v_params = ((PyObject*)values[2]);
    __pyx_v_operation = ((PyObject*)values[3]);
    __pyx_v_name = ((PyObject*)values[4]);
    __pyx_v_preamble = ((PyObject*)values[5]);
    __pyx_v_loop_prep = ((PyObject*)values[6]);
    __pyx_v_after_loop = ((PyObject*)values[7]);
    __pyx_v_options = ((PyObject*)values[8]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel", 0, 6, 9, __pyx_nargs); __PYX_ERR(0, 731, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._get_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arginfos), (&PyTuple_Type), 1, "arginfos", 1))) __PYX_ERR(0, 733, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_type_map), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, 1, "type_map", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_params), (&PyTuple_Type), 1, "params", 1))) __PYX_ERR(0, 734, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_operation), (&PyUnicode_Type), 1, "operation", 1))) __PYX_ERR(0, 734, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 734, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_preamble), (&PyUnicode_Type), 1, "preamble", 1))) __PYX_ERR(0, 735, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loop_prep), (&PyUnicode_Type), 1, "loop_prep", 1))) __PYX_ERR(0, 735, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_after_loop), (&PyUnicode_Type), 1, "after_loop", 1))) __PYX_ERR(0, 735, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_options), (&PyTuple_Type), 1, "options", 1))) __PYX_ERR(0, 735, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_14_get_elementwise_kernel(__pyx_self, __pyx_v_arginfos, __pyx_v_type_map, __pyx_v_params, __pyx_v_operation, __pyx_v_name, __pyx_v_preamble, __pyx_v_loop_prep, __pyx_v_after_loop, __pyx_v_options);

  /* "cupy/_core/_kernel.pyx":731
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel(
 *         tuple arginfos, _TypeMap type_map,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_14_get_elementwise_kernel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, PyObject *__pyx_v_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_after_loop, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_elementwise_kernel", 0);

  /* "cupy/_core/_kernel.pyx":736
 *         tuple params, str operation, str name,
 *         str preamble, str loop_prep='', str after_loop='', tuple options=()):
 *     cdef str code = _get_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         arginfos, type_map, params, operation, name, preamble, loop_prep,
 *         after_loop
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cupy/_core/_kernel.pyx":738
 *     cdef str code = _get_elementwise_kernel_code(
 *         arginfos, type_map, params, operation, name, preamble, loop_prep,
 *         after_loop             # <<<<<<<<<<<<<<
 *     )
 *     return _get_simple_elementwise_kernel_from_code(name, code, options)
*/
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[9] = {__pyx_t_2, __pyx_v_arginfos, ((PyObject *)__pyx_v_type_map), __pyx_v_params, __pyx_v_operation, __pyx_v_name, __pyx_v_preamble, __pyx_v_loop_prep, __pyx_v_after_loop};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (9-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }

  /* "cupy/_core/_kernel.pyx":736
 *         tuple params, str operation, str name,
 *         str preamble, str loop_prep='', str after_loop='', tuple options=()):
 *     cdef str code = _get_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *         arginfos, type_map, params, operation, name, preamble, loop_prep,
 *         after_loop
*/
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 736, __pyx_L1_error)
  __pyx_v_code = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":740
 *         after_loop
 *     )
 *     return _get_simple_elementwise_kernel_from_code(name, code, options)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.options = __pyx_v_options;
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel_from_code(__pyx_v_name, __pyx_v_code, &__pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":731
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel(
 *         tuple arginfos, _TypeMap type_map,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._get_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":802
 *         readonly dict _cached_codes
 * 
 *     def __init__(self, in_params, out_params, operation,             # <<<<<<<<<<<<<<
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_params = 0;
  PyObject *__pyx_v_out_params = 0;
  PyObject *__pyx_v_operation = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_reduce_dims = 0;
  PyObject *__pyx_v_preamble = 0;
  PyObject *__pyx_v_no_return = 0;
  PyObject *__pyx_v_return_tuple = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_params,&__pyx_mstate_global->__pyx_n_u_out_params,&__pyx_mstate_global->__pyx_n_u_operation,&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_reduce_dims,&__pyx_mstate_global->__pyx_n_u_preamble,&__pyx_mstate_global->__pyx_n_u_no_return,&__pyx_mstate_global->__pyx_n_u_return_tuple,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 802, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(0, 802, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_kernel));

      /* "cupy/_core/_kernel.pyx":803
 * 
 *     def __init__(self, in_params, out_params, operation,
 *                  name='kernel', reduce_dims=True, preamble='',             # <<<<<<<<<<<<<<
 *                  no_return=False, return_tuple=False, **kwargs):
 *         if not compiler.is_valid_kernel_name(name):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":804
 *     def __init__(self, in_params, out_params, operation,
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):             # <<<<<<<<<<<<<<
 *         if not compiler.is_valid_kernel_name(name):
 *             raise ValueError(
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 8, i); __PYX_ERR(0, 802, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 802, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 802, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 802, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 802, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_kernel));

      /* "cupy/_core/_kernel.pyx":803
 * 
 *     def __init__(self, in_params, out_params, operation,
 *                  name='kernel', reduce_dims=True, preamble='',             # <<<<<<<<<<<<<<
 *                  no_return=False, return_tuple=False, **kwargs):
 *         if not compiler.is_valid_kernel_name(name):
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":804
 *     def __init__(self, in_params, out_params, operation,
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):             # <<<<<<<<<<<<<<
 *         if not compiler.is_valid_kernel_name(name):
 *             raise ValueError(
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_in_params = values[0];
    __pyx_v_out_params = values[1];
    __pyx_v_operation = values[2];
    __pyx_v_name = values[3];
    __pyx_v_reduce_dims = values[4];
    __pyx_v_preamble = values[5];
    __pyx_v_no_return = values[6];
    __pyx_v_return_tuple = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 8, __pyx_nargs); __PYX_ERR(0, 802, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel___init__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self), __pyx_v_in_params, __pyx_v_out_params, __pyx_v_operation, __pyx_v_name, __pyx_v_reduce_dims, __pyx_v_preamble, __pyx_v_no_return, __pyx_v_return_tuple, __pyx_v_kwargs);

  /* "cupy/_core/_kernel.pyx":802
 *         readonly dict _cached_codes
 * 
 *     def __init__(self, in_params, out_params, operation,             # <<<<<<<<<<<<<<
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_params, PyObject *__pyx_v_out_params, PyObject *__pyx_v_operation, PyObject *__pyx_v_name, PyObject *__pyx_v_reduce_dims, PyObject *__pyx_v_preamble, PyObject *__pyx_v_no_return, PyObject *__pyx_v_return_tuple, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_param_rest = NULL;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_p = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":805
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):
 *         if not compiler.is_valid_kernel_name(name):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'Invalid kernel name: "%s"' % name)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_compiler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_is_valid_kernel_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (!__pyx_t_6);
  if (unlikely(__pyx_t_7)) {

    /* "cupy/_core/_kernel.pyx":806
 *                  no_return=False, return_tuple=False, **kwargs):
 *         if not compiler.is_valid_kernel_name(name):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'Invalid kernel name: "%s"' % name)
 * 
*/
    __pyx_t_4 = NULL;

    /* "cupy/_core/_kernel.pyx":807
 *         if not compiler.is_valid_kernel_name(name):
 *             raise ValueError(
 *                 'Invalid kernel name: "%s"' % name)             # <<<<<<<<<<<<<<
 * 
 *         self.in_params = _get_param_info(in_params, True)
*/
    __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_Invalid_kernel_name_s, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 806, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":805
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):
 *         if not compiler.is_valid_kernel_name(name):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'Invalid kernel name: "%s"' % name)
*/
  }

  /* "cupy/_core/_kernel.pyx":809
 *                 'Invalid kernel name: "%s"' % name)
 * 
 *         self.in_params = _get_param_info(in_params, True)             # <<<<<<<<<<<<<<
 *         self.out_params = _get_param_info(out_params, False)
 *         self.nin = len(self.in_params)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_param_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_in_params, Py_True};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->in_params);
  __Pyx_DECREF(__pyx_v_self->in_params);
  __pyx_v_self->in_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":810
 * 
 *         self.in_params = _get_param_info(in_params, True)
 *         self.out_params = _get_param_info(out_params, False)             # <<<<<<<<<<<<<<
 *         self.nin = len(self.in_params)
 *         self.nout = len(self.out_params)
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_param_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_out_params, Py_False};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->out_params);
  __Pyx_DECREF(__pyx_v_self->out_params);
  __pyx_v_self->out_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":811
 *         self.in_params = _get_param_info(in_params, True)
 *         self.out_params = _get_param_info(out_params, False)
 *         self.nin = len(self.in_params)             # <<<<<<<<<<<<<<
 *         self.nout = len(self.out_params)
 *         self.nargs = self.nin + self.nout
*/
  __pyx_t_1 = __pyx_v_self->in_params;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 811, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->nin = __pyx_t_8;

  /* "cupy/_core/_kernel.pyx":812
 *         self.out_params = _get_param_info(out_params, False)
 *         self.nin = len(self.in_params)
 *         self.nout = len(self.out_params)             # <<<<<<<<<<<<<<
 *         self.nargs = self.nin + self.nout
 *         param_rest = _get_param_info('CIndexer _ind', False)
*/
  __pyx_t_1 = __pyx_v_self->out_params;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 812, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->nout = __pyx_t_8;

  /* "cupy/_core/_kernel.pyx":813
 *         self.nin = len(self.in_params)
 *         self.nout = len(self.out_params)
 *         self.nargs = self.nin + self.nout             # <<<<<<<<<<<<<<
 *         param_rest = _get_param_info('CIndexer _ind', False)
 *         self.params = self.in_params + self.out_params + param_rest
*/
  __pyx_v_self->nargs = (__pyx_v_self->nin + __pyx_v_self->nout);

  /* "cupy/_core/_kernel.pyx":814
 *         self.nout = len(self.out_params)
 *         self.nargs = self.nin + self.nout
 *         param_rest = _get_param_info('CIndexer _ind', False)             # <<<<<<<<<<<<<<
 *         self.params = self.in_params + self.out_params + param_rest
 *         self.operation = operation
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_get_param_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_param_rest = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":815
 *         self.nargs = self.nin + self.nout
 *         param_rest = _get_param_info('CIndexer _ind', False)
 *         self.params = self.in_params + self.out_params + param_rest             # <<<<<<<<<<<<<<
 *         self.operation = operation
 *         self.name = name
*/
  __pyx_t_2 = PyNumber_Add(__pyx_v_self->in_params, __pyx_v_self->out_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_param_rest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->params);
  __Pyx_DECREF(__pyx_v_self->params);
  __pyx_v_self->params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":816
 *         param_rest = _get_param_info('CIndexer _ind', False)
 *         self.params = self.in_params + self.out_params + param_rest
 *         self.operation = operation             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.reduce_dims = reduce_dims
*/
  __Pyx_INCREF(__pyx_v_operation);
  __Pyx_GIVEREF(__pyx_v_operation);
  __Pyx_GOTREF(__pyx_v_self->operation);
  __Pyx_DECREF(__pyx_v_self->operation);
  __pyx_v_self->operation = __pyx_v_operation;

  /* "cupy/_core/_kernel.pyx":817
 *         self.params = self.in_params + self.out_params + param_rest
 *         self.operation = operation
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.reduce_dims = reduce_dims
 *         self.preamble = preamble
*/
  __pyx_t_1 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":818
 *         self.operation = operation
 *         self.name = name
 *         self.reduce_dims = reduce_dims             # <<<<<<<<<<<<<<
 *         self.preamble = preamble
 *         self.no_return = no_return
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_reduce_dims); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L1_error)
  __pyx_v_self->reduce_dims = __pyx_t_7;

  /* "cupy/_core/_kernel.pyx":819
 *         self.name = name
 *         self.reduce_dims = reduce_dims
 *         self.preamble = preamble             # <<<<<<<<<<<<<<
 *         self.no_return = no_return
 *         self.return_tuple = return_tuple
*/
  __Pyx_INCREF(__pyx_v_preamble);
  __Pyx_GIVEREF(__pyx_v_preamble);
  __Pyx_GOTREF(__pyx_v_self->preamble);
  __Pyx_DECREF(__pyx_v_self->preamble);
  __pyx_v_self->preamble = __pyx_v_preamble;

  /* "cupy/_core/_kernel.pyx":820
 *         self.reduce_dims = reduce_dims
 *         self.preamble = preamble
 *         self.no_return = no_return             # <<<<<<<<<<<<<<
 *         self.return_tuple = return_tuple
 *         self.kwargs = kwargs
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_no_return); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error)
  __pyx_v_self->no_return = __pyx_t_7;

  /* "cupy/_core/_kernel.pyx":821
 *         self.preamble = preamble
 *         self.no_return = no_return
 *         self.return_tuple = return_tuple             # <<<<<<<<<<<<<<
 *         self.kwargs = kwargs
 *         self._params_type_memo = {}
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_return_tuple); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L1_error)
  __pyx_v_self->return_tuple = __pyx_t_7;

  /* "cupy/_core/_kernel.pyx":822
 *         self.no_return = no_return
 *         self.return_tuple = return_tuple
 *         self.kwargs = kwargs             # <<<<<<<<<<<<<<
 *         self._params_type_memo = {}
 *         self._cached_codes = {}
*/
  __Pyx_INCREF(__pyx_v_kwargs);
  __Pyx_GIVEREF(__pyx_v_kwargs);
  __Pyx_GOTREF(__pyx_v_self->kwargs);
  __Pyx_DECREF(__pyx_v_self->kwargs);
  __pyx_v_self->kwargs = __pyx_v_kwargs;

  /* "cupy/_core/_kernel.pyx":823
 *         self.return_tuple = return_tuple
 *         self.kwargs = kwargs
 *         self._params_type_memo = {}             # <<<<<<<<<<<<<<
 *         self._cached_codes = {}
 *         names = [p.name for p in self.in_params + self.out_params]
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_params_type_memo);
  __Pyx_DECREF(__pyx_v_self->_params_type_memo);
  __pyx_v_self->_params_type_memo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":824
 *         self.kwargs = kwargs
 *         self._params_type_memo = {}
 *         self._cached_codes = {}             # <<<<<<<<<<<<<<
 *         names = [p.name for p in self.in_params + self.out_params]
 *         if 'i' in names:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_cached_codes);
  __Pyx_DECREF(__pyx_v_self->_cached_codes);
  __pyx_v_self->_cached_codes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":825
 *         self._params_type_memo = {}
 *         self._cached_codes = {}
 *         names = [p.name for p in self.in_params + self.out_params]             # <<<<<<<<<<<<<<
 *         if 'i' in names:
 *             raise ValueError('Can not use \'i\' as a parameter name')
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Add(__pyx_v_self->in_params, __pyx_v_self->out_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 825, __pyx_L6_error)
        #endif
        if (__pyx_t_8 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
      #endif
      ++__pyx_t_8;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_p, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr7__pyx_v_p, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 825, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_p); __pyx_8genexpr7__pyx_v_p = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_p); __pyx_8genexpr7__pyx_v_p = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_v_names = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":826
 *         self._cached_codes = {}
 *         names = [p.name for p in self.in_params + self.out_params]
 *         if 'i' in names:             # <<<<<<<<<<<<<<
 *             raise ValueError('Can not use \'i\' as a parameter name')
 *         self._elementwise_kernel_memo = {}
*/
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_i, __pyx_v_names, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 826, __pyx_L1_error)
  if (unlikely(__pyx_t_7)) {

    /* "cupy/_core/_kernel.pyx":827
 *         names = [p.name for p in self.in_params + self.out_params]
 *         if 'i' in names:
 *             raise ValueError('Can not use \'i\' as a parameter name')             # <<<<<<<<<<<<<<
 *         self._elementwise_kernel_memo = {}
 *         # This is for profiling mechanisms to auto infer a name
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Can_not_use_i_as_a_parameter_nam};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 827, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":826
 *         self._cached_codes = {}
 *         names = [p.name for p in self.in_params + self.out_params]
 *         if 'i' in names:             # <<<<<<<<<<<<<<
 *             raise ValueError('Can not use \'i\' as a parameter name')
 *         self._elementwise_kernel_memo = {}
*/
  }

  /* "cupy/_core/_kernel.pyx":828
 *         if 'i' in names:
 *             raise ValueError('Can not use \'i\' as a parameter name')
 *         self._elementwise_kernel_memo = {}             # <<<<<<<<<<<<<<
 *         # This is for profiling mechanisms to auto infer a name
 *         self.__name__ = name
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_elementwise_kernel_memo);
  __Pyx_DECREF(__pyx_v_self->_elementwise_kernel_memo);
  __pyx_v_self->_elementwise_kernel_memo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":830
 *         self._elementwise_kernel_memo = {}
 *         # This is for profiling mechanisms to auto infer a name
 *         self.__name__ = name             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, *args, **kwargs):
*/
  __pyx_t_1 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx___name__);
  __Pyx_DECREF(__pyx_v_self->__pyx___name__);
  __pyx_v_self->__pyx___name__ = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":802
 *         readonly dict _cached_codes
 * 
 *     def __init__(self, in_params, out_params, operation,             # <<<<<<<<<<<<<<
 *                  name='kernel', reduce_dims=True, preamble='',
 *                  no_return=False, return_tuple=False, **kwargs):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_param_rest);
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_p);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":832
 *         self.__name__ = name
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Compiles and invokes the elementwise kernel.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__, "ElementwiseKernel.__call__(self, *args, **kwargs)\n\nCompiles and invokes the elementwise kernel.\n\nThe compilation runs only if the kernel is not cached. Note that the\nkernels with different argument dtypes or dimensions are not\ncompatible. It means that single ElementwiseKernel object may be\ncompiled into multiple kernel binaries.\n\nArgs:\n    args: Arguments of the kernel.\n    size (int): Range size of the indices.  By default, the range size\n        is automatically determined from the result of broadcasting.\n        This parameter must be specified if and only if all ndarrays\n        are `raw` and the range size cannot be determined\n        automatically.\n    block_size (int): Number of threads per block. By default, the\n        value is set to 128.\n\nReturns:\n    If ``no_return`` has not set, arrays are returned according to the\n    ``out_params`` argument of the ``__init__`` method.\n    If ``no_return`` has set, ``None`` is returned.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__;
#endif
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("__call__", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_v_kern = 0;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_in_args = 0;
  PyObject *__pyx_v_out_args = 0;
  PyObject *__pyx_v_in_types = 0;
  PyObject *__pyx_v_out_types = 0;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_v_shape;
  PyObject *__pyx_v_stream = NULL;
  PyObject *__pyx_v_block_size = NULL;
  Py_ssize_t __pyx_v_n_args;
  PyObject *__pyx_v_arg = NULL;
  int __pyx_v_dev_id;
  PyObject *__pyx_v_arg_list = NULL;
  PyObject *__pyx_v_in_ndarray_types = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_out_ndarray_types = NULL;
  PyObject *__pyx_v_type_map = NULL;
  int __pyx_v_is_size_specified;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_inout_args = NULL;
  struct __pyx_obj_4cupy_5_core_7_carray_Indexer *__pyx_v_indexer = NULL;
  PyObject *__pyx_v_arginfos = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_t_15;
  struct __pyx_opt_args_4cupy_4cuda_8function_8Function_linear_launch __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "cupy/_core/_kernel.pyx":862
 *         cdef shape_t shape
 * 
 *         size = kwargs.pop('size', -1)             # <<<<<<<<<<<<<<
 *         stream = kwargs.pop('stream', None)
 *         block_size = kwargs.pop('block_size', 128)
*/
  __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_size, __pyx_mstate_global->__pyx_int_neg_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_size = __pyx_t_2;

  /* "cupy/_core/_kernel.pyx":863
 * 
 *         size = kwargs.pop('size', -1)
 *         stream = kwargs.pop('stream', None)             # <<<<<<<<<<<<<<
 *         block_size = kwargs.pop('block_size', 128)
 *         if len(kwargs):
*/
  __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_stream, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_stream = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":864
 *         size = kwargs.pop('size', -1)
 *         stream = kwargs.pop('stream', None)
 *         block_size = kwargs.pop('block_size', 128)             # <<<<<<<<<<<<<<
 *         if len(kwargs):
 *             raise TypeError('Wrong arguments %s' % kwargs)
*/
  __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_block_size, __pyx_mstate_global->__pyx_int_128); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_block_size = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":865
 *         stream = kwargs.pop('stream', None)
 *         block_size = kwargs.pop('block_size', 128)
 *         if len(kwargs):             # <<<<<<<<<<<<<<
 *             raise TypeError('Wrong arguments %s' % kwargs)
 *         if block_size <= 0:
*/
  __pyx_t_2 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 865, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cupy/_core/_kernel.pyx":866
 *         block_size = kwargs.pop('block_size', 128)
 *         if len(kwargs):
 *             raise TypeError('Wrong arguments %s' % kwargs)             # <<<<<<<<<<<<<<
 *         if block_size <= 0:
 *             raise ValueError('block_size must be greater than zero')
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Wrong_arguments_s, __pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 866, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 866, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":865
 *         stream = kwargs.pop('stream', None)
 *         block_size = kwargs.pop('block_size', 128)
 *         if len(kwargs):             # <<<<<<<<<<<<<<
 *             raise TypeError('Wrong arguments %s' % kwargs)
 *         if block_size <= 0:
*/
  }

  /* "cupy/_core/_kernel.pyx":867
 *         if len(kwargs):
 *             raise TypeError('Wrong arguments %s' % kwargs)
 *         if block_size <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('block_size must be greater than zero')
 *         n_args = len(args)
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_block_size, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "cupy/_core/_kernel.pyx":868
 *             raise TypeError('Wrong arguments %s' % kwargs)
 *         if block_size <= 0:
 *             raise ValueError('block_size must be greater than zero')             # <<<<<<<<<<<<<<
 *         n_args = len(args)
 *         if n_args != self.nin and n_args != self.nargs:
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_block_size_must_be_greater_than};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 868, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":867
 *         if len(kwargs):
 *             raise TypeError('Wrong arguments %s' % kwargs)
 *         if block_size <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('block_size must be greater than zero')
 *         n_args = len(args)
*/
  }

  /* "cupy/_core/_kernel.pyx":869
 *         if block_size <= 0:
 *             raise ValueError('block_size must be greater than zero')
 *         n_args = len(args)             # <<<<<<<<<<<<<<
 *         if n_args != self.nin and n_args != self.nargs:
 *             raise TypeError(
*/
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 869, __pyx_L1_error)
  __pyx_v_n_args = __pyx_t_2;

  /* "cupy/_core/_kernel.pyx":870
 *             raise ValueError('block_size must be greater than zero')
 *         n_args = len(args)
 *         if n_args != self.nin and n_args != self.nargs:             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Wrong number of arguments for {!r}. '
*/
  __pyx_t_7 = (__pyx_v_n_args != __pyx_v_self->nin);
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_n_args != __pyx_v_self->nargs);
  __pyx_t_3 = __pyx_t_7;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "cupy/_core/_kernel.pyx":871
 *         n_args = len(args)
 *         if n_args != self.nin and n_args != self.nargs:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Wrong number of arguments for {!r}. '
 *                 'It must be either {} or {} (with outputs), '
*/
    __pyx_t_5 = NULL;

    /* "cupy/_core/_kernel.pyx":874
 *                 'Wrong number of arguments for {!r}. '
 *                 'It must be either {} or {} (with outputs), '
 *                 'but given {}.'.format(             # <<<<<<<<<<<<<<
 *                     self.name, self.nin, self.nargs, n_args))
 *         for arg in args:
*/
    __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_Wrong_number_of_arguments_for_r;
    __Pyx_INCREF(__pyx_t_8);

    /* "cupy/_core/_kernel.pyx":875
 *                 'It must be either {} or {} (with outputs), '
 *                 'but given {}.'.format(
 *                     self.name, self.nin, self.nargs, n_args))             # <<<<<<<<<<<<<<
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
*/
    __pyx_t_9 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyLong_FromSsize_t(__pyx_v_n_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_8, __pyx_v_self->name, __pyx_t_9, __pyx_t_10, __pyx_t_11};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 874, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 871, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":870
 *             raise ValueError('block_size must be greater than zero')
 *         n_args = len(args)
 *         if n_args != self.nin and n_args != self.nargs:             # <<<<<<<<<<<<<<
 *             raise TypeError(
 *                 'Wrong number of arguments for {!r}. '
*/
  }

  /* "cupy/_core/_kernel.pyx":876
 *                 'but given {}.'.format(
 *                     self.name, self.nin, self.nargs, n_args))
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
*/
  __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 876, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":877
 *                     self.name, self.nin, self.nargs, n_args))
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):             # <<<<<<<<<<<<<<
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)
*/
    __pyx_t_3 = __Pyx_HasAttr(__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_cupy_override_elementwise_kern); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 877, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":878
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 *         dev_id = device.get_device_id()
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_cupy_override_elementwise_kern); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "cupy/_core/_kernel.pyx":879
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         dev_id = device.get_device_id()
 *         arg_list = _preprocess_args(dev_id, args)
*/
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 878, __pyx_L1_error);

      /* "cupy/_core/_kernel.pyx":878
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 *         dev_id = device.get_device_id()
*/
      __pyx_t_11 = PyNumber_Add(__pyx_t_5, __pyx_v_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":879
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)             # <<<<<<<<<<<<<<
 *         dev_id = device.get_device_id()
 *         arg_list = _preprocess_args(dev_id, args)
*/
      __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "cupy/_core/_kernel.pyx":878
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 *         dev_id = device.get_device_id()
*/
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":877
 *                     self.name, self.nin, self.nargs, n_args))
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):             # <<<<<<<<<<<<<<
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)
*/
    }

    /* "cupy/_core/_kernel.pyx":876
 *                 'but given {}.'.format(
 *                     self.name, self.nin, self.nargs, n_args))
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":880
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)
 *         dev_id = device.get_device_id()             # <<<<<<<<<<<<<<
 *         arg_list = _preprocess_args(dev_id, args)
 * 
*/
  __pyx_t_12 = __pyx_f_4cupy_4cuda_6device_get_device_id(0); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L1_error)
  __pyx_v_dev_id = __pyx_t_12;

  /* "cupy/_core/_kernel.pyx":881
 *                     self, *args, **kwargs)
 *         dev_id = device.get_device_id()
 *         arg_list = _preprocess_args(dev_id, args)             # <<<<<<<<<<<<<<
 * 
 *         out_args = arg_list[self.nin:]
*/
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__preprocess_args(__pyx_v_dev_id, __pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_arg_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":883
 *         arg_list = _preprocess_args(dev_id, args)
 * 
 *         out_args = arg_list[self.nin:]             # <<<<<<<<<<<<<<
 *         # _broadcast updates shape
 *         in_args = _broadcast(
*/
  if (unlikely(__pyx_v_arg_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 883, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_arg_list, __pyx_v_self->nin, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":886
 *         # _broadcast updates shape
 *         in_args = _broadcast(
 *             arg_list, self.params, size != -1, shape)[:self.nin]             # <<<<<<<<<<<<<<
 * 
 *         in_ndarray_types = []
*/
  __pyx_t_1 = __pyx_v_self->params;
  __Pyx_INCREF(__pyx_t_1);

  /* "cupy/_core/_kernel.pyx":885
 *         out_args = arg_list[self.nin:]
 *         # _broadcast updates shape
 *         in_args = _broadcast(             # <<<<<<<<<<<<<<
 *             arg_list, self.params, size != -1, shape)[:self.nin]
 * 
*/
  __pyx_t_10 = __pyx_f_4cupy_5_core_7_kernel__broadcast(__pyx_v_arg_list, ((PyObject*)__pyx_t_1), (__pyx_v_size != -1L), __pyx_v_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_10 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 885, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":886
 *         # _broadcast updates shape
 *         in_args = _broadcast(
 *             arg_list, self.params, size != -1, shape)[:self.nin]             # <<<<<<<<<<<<<<
 * 
 *         in_ndarray_types = []
*/
  __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_t_10, 0, __pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_in_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":888
 *             arg_list, self.params, size != -1, shape)[:self.nin]
 * 
 *         in_ndarray_types = []             # <<<<<<<<<<<<<<
 *         for a in in_args:
 *             if isinstance(a, _ndarray_base):
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_in_ndarray_types = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":889
 * 
 *         in_ndarray_types = []
 *         for a in in_args:             # <<<<<<<<<<<<<<
 *             if isinstance(a, _ndarray_base):
 *                 t = a.dtype
*/
  __pyx_t_1 = __pyx_v_in_args; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 889, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "cupy/_core/_kernel.pyx":890
 *         in_ndarray_types = []
 *         for a in in_args:
 *             if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *                 t = a.dtype
 *             elif isinstance(a, texture.TextureObject):
*/
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":891
 *         for a in in_args:
 *             if isinstance(a, _ndarray_base):
 *                 t = a.dtype             # <<<<<<<<<<<<<<
 *             elif isinstance(a, texture.TextureObject):
 *                 t = 'cudaTextureObject_t'
*/
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "cupy/_core/_kernel.pyx":890
 *         in_ndarray_types = []
 *         for a in in_args:
 *             if isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *                 t = a.dtype
 *             elif isinstance(a, texture.TextureObject):
*/
      goto __pyx_L14;
    }

    /* "cupy/_core/_kernel.pyx":892
 *             if isinstance(a, _ndarray_base):
 *                 t = a.dtype
 *             elif isinstance(a, texture.TextureObject):             # <<<<<<<<<<<<<<
 *                 t = 'cudaTextureObject_t'
 *             else:
*/
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_7texture_TextureObject); 
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":893
 *                 t = a.dtype
 *             elif isinstance(a, texture.TextureObject):
 *                 t = 'cudaTextureObject_t'             # <<<<<<<<<<<<<<
 *             else:
 *                 t = None
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_cudaTextureObject_t);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_mstate_global->__pyx_n_u_cudaTextureObject_t);

      /* "cupy/_core/_kernel.pyx":892
 *             if isinstance(a, _ndarray_base):
 *                 t = a.dtype
 *             elif isinstance(a, texture.TextureObject):             # <<<<<<<<<<<<<<
 *                 t = 'cudaTextureObject_t'
 *             else:
*/
      goto __pyx_L14;
    }

    /* "cupy/_core/_kernel.pyx":895
 *                 t = 'cudaTextureObject_t'
 *             else:
 *                 t = None             # <<<<<<<<<<<<<<
 *             in_ndarray_types.append(t)
 *         in_ndarray_types = tuple(in_ndarray_types)
*/
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_t, Py_None);
    }
    __pyx_L14:;

    /* "cupy/_core/_kernel.pyx":896
 *             else:
 *                 t = None
 *             in_ndarray_types.append(t)             # <<<<<<<<<<<<<<
 *         in_ndarray_types = tuple(in_ndarray_types)
 *         out_ndarray_types = tuple([a.dtype for a in out_args])
*/
    __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_in_ndarray_types, __pyx_v_t); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 896, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":889
 * 
 *         in_ndarray_types = []
 *         for a in in_args:             # <<<<<<<<<<<<<<
 *             if isinstance(a, _ndarray_base):
 *                 t = a.dtype
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":897
 *                 t = None
 *             in_ndarray_types.append(t)
 *         in_ndarray_types = tuple(in_ndarray_types)             # <<<<<<<<<<<<<<
 *         out_ndarray_types = tuple([a.dtype for a in out_args])
 * 
*/
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_in_ndarray_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_in_ndarray_types, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":898
 *             in_ndarray_types.append(t)
 *         in_ndarray_types = tuple(in_ndarray_types)
 *         out_ndarray_types = tuple([a.dtype for a in out_args])             # <<<<<<<<<<<<<<
 * 
 *         in_types, out_types, type_map = self._decide_params_type(
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __pyx_v_out_args; __Pyx_INCREF(__pyx_t_10);
    __pyx_t_2 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 898, __pyx_L18_error)
        #endif
        if (__pyx_t_2 >= __pyx_temp) break;
      }
      __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_2;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 898, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_a, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr8__pyx_v_a, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 898, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 898, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a); __pyx_8genexpr8__pyx_v_a = 0;
    goto __pyx_L22_exit_scope;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a); __pyx_8genexpr8__pyx_v_a = 0;
    goto __pyx_L1_error;
    __pyx_L22_exit_scope:;
  } /* exit inner scope */
  __pyx_t_10 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_out_ndarray_types = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "cupy/_core/_kernel.pyx":901
 * 
 *         in_types, out_types, type_map = self._decide_params_type(
 *             in_ndarray_types, out_ndarray_types)             # <<<<<<<<<<<<<<
 * 
 *         is_size_specified = False
*/
  __pyx_t_10 = __pyx_v_in_ndarray_types;
  __Pyx_INCREF(__pyx_t_10);
  if (!(likely(PyTuple_CheckExact(__pyx_t_10)) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_10))) __PYX_ERR(0, 901, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":900
 *         out_ndarray_types = tuple([a.dtype for a in out_args])
 * 
 *         in_types, out_types, type_map = self._decide_params_type(             # <<<<<<<<<<<<<<
 *             in_ndarray_types, out_ndarray_types)
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self->__pyx_vtab)->_decide_params_type(__pyx_v_self, ((PyObject*)__pyx_t_10), __pyx_v_out_ndarray_types, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 900, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_11);
    #else
    __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 900, __pyx_L1_error)
  }
  if (!(likely(PyTuple_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_10))) __PYX_ERR(0, 900, __pyx_L1_error)
  if (!(likely(PyTuple_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_5))) __PYX_ERR(0, 900, __pyx_L1_error)
  __pyx_v_in_types = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_v_out_types = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_type_map = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":903
 *             in_ndarray_types, out_ndarray_types)
 * 
 *         is_size_specified = False             # <<<<<<<<<<<<<<
 *         if size != -1:
 *             shape.assign(1, size)
*/
  __pyx_v_is_size_specified = 0;

  /* "cupy/_core/_kernel.pyx":904
 * 
 *         is_size_specified = False
 *         if size != -1:             # <<<<<<<<<<<<<<
 *             shape.assign(1, size)
 *             is_size_specified = True
*/
  __pyx_t_3 = (__pyx_v_size != -1L);
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":905
 *         is_size_specified = False
 *         if size != -1:
 *             shape.assign(1, size)             # <<<<<<<<<<<<<<
 *             is_size_specified = True
 * 
*/
    __pyx_v_shape.assign(1, __pyx_v_size); 

    /* "cupy/_core/_kernel.pyx":906
 *         if size != -1:
 *             shape.assign(1, size)
 *             is_size_specified = True             # <<<<<<<<<<<<<<
 * 
 *         out_args = _get_out_args_with_params(
*/
    __pyx_v_is_size_specified = 1;

    /* "cupy/_core/_kernel.pyx":904
 * 
 *         is_size_specified = False
 *         if size != -1:             # <<<<<<<<<<<<<<
 *             shape.assign(1, size)
 *             is_size_specified = True
*/
  }

  /* "cupy/_core/_kernel.pyx":909
 * 
 *         out_args = _get_out_args_with_params(
 *             out_args, out_types, shape, self.out_params, is_size_specified)             # <<<<<<<<<<<<<<
 *         if self.no_return:
 *             ret = None
*/
  __pyx_t_1 = __pyx_v_self->out_params;
  __Pyx_INCREF(__pyx_t_1);

  /* "cupy/_core/_kernel.pyx":908
 *             is_size_specified = True
 * 
 *         out_args = _get_out_args_with_params(             # <<<<<<<<<<<<<<
 *             out_args, out_types, shape, self.out_params, is_size_specified)
 *         if self.no_return:
*/
  __pyx_t_11 = __pyx_f_4cupy_5_core_7_kernel__get_out_args_with_params(__pyx_v_out_args, __pyx_v_out_types, __pyx_v_shape, ((PyObject*)__pyx_t_1), __pyx_v_is_size_specified); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_out_args, ((PyObject*)__pyx_t_11));
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":910
 *         out_args = _get_out_args_with_params(
 *             out_args, out_types, shape, self.out_params, is_size_specified)
 *         if self.no_return:             # <<<<<<<<<<<<<<
 *             ret = None
 *         elif not self.return_tuple and self.nout == 1:
*/
  if (__pyx_v_self->no_return) {

    /* "cupy/_core/_kernel.pyx":911
 *             out_args, out_types, shape, self.out_params, is_size_specified)
 *         if self.no_return:
 *             ret = None             # <<<<<<<<<<<<<<
 *         elif not self.return_tuple and self.nout == 1:
 *             ret = out_args[0]
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_ret = Py_None;

    /* "cupy/_core/_kernel.pyx":910
 *         out_args = _get_out_args_with_params(
 *             out_args, out_types, shape, self.out_params, is_size_specified)
 *         if self.no_return:             # <<<<<<<<<<<<<<
 *             ret = None
 *         elif not self.return_tuple and self.nout == 1:
*/
    goto __pyx_L24;
  }

  /* "cupy/_core/_kernel.pyx":912
 *         if self.no_return:
 *             ret = None
 *         elif not self.return_tuple and self.nout == 1:             # <<<<<<<<<<<<<<
 *             ret = out_args[0]
 *         else:
*/
  __pyx_t_7 = (!__pyx_v_self->return_tuple);
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->nout == 1);
  __pyx_t_3 = __pyx_t_7;
  __pyx_L25_bool_binop_done:;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":913
 *             ret = None
 *         elif not self.return_tuple and self.nout == 1:
 *             ret = out_args[0]             # <<<<<<<<<<<<<<
 *         else:
 *             ret = tuple(out_args)
*/
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 913, __pyx_L1_error)
    }
    __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_out_args, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_v_ret = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "cupy/_core/_kernel.pyx":912
 *         if self.no_return:
 *             ret = None
 *         elif not self.return_tuple and self.nout == 1:             # <<<<<<<<<<<<<<
 *             ret = out_args[0]
 *         else:
*/
    goto __pyx_L24;
  }

  /* "cupy/_core/_kernel.pyx":915
 *             ret = out_args[0]
 *         else:
 *             ret = tuple(out_args)             # <<<<<<<<<<<<<<
 * 
 *         if _contains_zero(shape):
*/
  /*else*/ {
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 915, __pyx_L1_error)
    }
    __pyx_t_11 = PyList_AsTuple(__pyx_v_out_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_v_ret = __pyx_t_11;
    __pyx_t_11 = 0;
  }
  __pyx_L24:;

  /* "cupy/_core/_kernel.pyx":917
 *             ret = tuple(out_args)
 * 
 *         if _contains_zero(shape):             # <<<<<<<<<<<<<<
 *             return ret
 * 
*/
  __pyx_t_3 = __pyx_f_4cupy_5_core_7_kernel__contains_zero(__pyx_v_shape); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 917, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":918
 * 
 *         if _contains_zero(shape):
 *             return ret             # <<<<<<<<<<<<<<
 * 
 *         for i, x in enumerate(in_args):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_ret);
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":917
 *             ret = tuple(out_args)
 * 
 *         if _contains_zero(shape):             # <<<<<<<<<<<<<<
 *             return ret
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":920
 *             return ret
 * 
 *         for i, x in enumerate(in_args):             # <<<<<<<<<<<<<<
 *             if type(x) is _scalar.CScalar:
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])
*/
  __pyx_t_2 = 0;
  __pyx_t_11 = __pyx_v_in_args; __Pyx_INCREF(__pyx_t_11);
  __pyx_t_14 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 920, __pyx_L1_error)
      #endif
      if (__pyx_t_14 >= __pyx_temp) break;
    }
    __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_14, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_14;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_i = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);

    /* "cupy/_core/_kernel.pyx":921
 * 
 *         for i, x in enumerate(in_args):
 *             if type(x) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])
 * 
*/
    __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_x)) == ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar));
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":922
 *         for i, x in enumerate(in_args):
 *             if type(x) is _scalar.CScalar:
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])             # <<<<<<<<<<<<<<
 * 
 *         inout_args = in_args + out_args
*/
      if (unlikely(__pyx_v_in_types == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 922, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_in_types, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = ((struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar *)((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_v_x)->__pyx_vtab)->apply_dtype(((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_v_x), __pyx_t_1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":921
 * 
 *         for i, x in enumerate(in_args):
 *             if type(x) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])
 * 
*/
    }

    /* "cupy/_core/_kernel.pyx":920
 *             return ret
 * 
 *         for i, x in enumerate(in_args):             # <<<<<<<<<<<<<<
 *             if type(x) is _scalar.CScalar:
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])
*/
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":924
 *                 (<_scalar.CScalar>x).apply_dtype(in_types[i])
 * 
 *         inout_args = in_args + out_args             # <<<<<<<<<<<<<<
 * 
 *         if self.reduce_dims:
*/
  __pyx_t_11 = PyNumber_Add(__pyx_v_in_args, __pyx_v_out_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v_inout_args = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":926
 *         inout_args = in_args + out_args
 * 
 *         if self.reduce_dims:             # <<<<<<<<<<<<<<
 *             shape = _reduce_dims(inout_args, self.params, shape)
 *         indexer = _carray._indexer_init(shape)
*/
  if (__pyx_v_self->reduce_dims) {

    /* "cupy/_core/_kernel.pyx":927
 * 
 *         if self.reduce_dims:
 *             shape = _reduce_dims(inout_args, self.params, shape)             # <<<<<<<<<<<<<<
 *         indexer = _carray._indexer_init(shape)
 *         inout_args.append(indexer)
*/
    __pyx_t_11 = __pyx_v_self->params;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_15 = __pyx_f_4cupy_5_core_7_kernel__reduce_dims(__pyx_v_inout_args, ((PyObject*)__pyx_t_11), __pyx_v_shape); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_shape = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_15);

    /* "cupy/_core/_kernel.pyx":926
 *         inout_args = in_args + out_args
 * 
 *         if self.reduce_dims:             # <<<<<<<<<<<<<<
 *             shape = _reduce_dims(inout_args, self.params, shape)
 *         indexer = _carray._indexer_init(shape)
*/
  }

  /* "cupy/_core/_kernel.pyx":928
 *         if self.reduce_dims:
 *             shape = _reduce_dims(inout_args, self.params, shape)
 *         indexer = _carray._indexer_init(shape)             # <<<<<<<<<<<<<<
 *         inout_args.append(indexer)
 * 
*/
  __pyx_t_11 = ((PyObject *)__pyx_f_4cupy_5_core_7_carray__indexer_init(__pyx_v_shape)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v_indexer = ((struct __pyx_obj_4cupy_5_core_7_carray_Indexer *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":929
 *             shape = _reduce_dims(inout_args, self.params, shape)
 *         indexer = _carray._indexer_init(shape)
 *         inout_args.append(indexer)             # <<<<<<<<<<<<<<
 * 
 *         arginfos = _get_arginfos(inout_args)
*/
  __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_inout_args, ((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 929, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":931
 *         inout_args.append(indexer)
 * 
 *         arginfos = _get_arginfos(inout_args)             # <<<<<<<<<<<<<<
 *         kern = self._get_elementwise_kernel(dev_id, arginfos, type_map)
 *         kern.linear_launch(indexer.size, inout_args, shared_mem=0,
*/
  __pyx_t_11 = __pyx_f_4cupy_5_core_7_kernel__get_arginfos(__pyx_v_inout_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v_arginfos = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":932
 * 
 *         arginfos = _get_arginfos(inout_args)
 *         kern = self._get_elementwise_kernel(dev_id, arginfos, type_map)             # <<<<<<<<<<<<<<
 *         kern.linear_launch(indexer.size, inout_args, shared_mem=0,
 *                            block_max_size=block_size, stream=stream)
*/
  if (!(likely(((__pyx_v_type_map) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_type_map, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap))))) __PYX_ERR(0, 932, __pyx_L1_error)
  __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self->__pyx_vtab)->_get_elementwise_kernel(__pyx_v_self, __pyx_v_dev_id, __pyx_v_arginfos, ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v_type_map), 0)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_v_kern = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":934
 *         kern = self._get_elementwise_kernel(dev_id, arginfos, type_map)
 *         kern.linear_launch(indexer.size, inout_args, shared_mem=0,
 *                            block_max_size=block_size, stream=stream)             # <<<<<<<<<<<<<<
 *         return ret
 * 
*/
  __pyx_t_6 = __Pyx_PyLong_As_size_t(__pyx_v_block_size); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":933
 *         arginfos = _get_arginfos(inout_args)
 *         kern = self._get_elementwise_kernel(dev_id, arginfos, type_map)
 *         kern.linear_launch(indexer.size, inout_args, shared_mem=0,             # <<<<<<<<<<<<<<
 *                            block_max_size=block_size, stream=stream)
 *         return ret
*/
  __pyx_t_16.__pyx_n = 3;
  __pyx_t_16.shared_mem = 0;
  __pyx_t_16.block_max_size = __pyx_t_6;
  __pyx_t_16.stream = __pyx_v_stream;
  __pyx_t_11 = ((struct __pyx_vtabstruct_4cupy_4cuda_8function_Function *)__pyx_v_kern->__pyx_vtab)->linear_launch(__pyx_v_kern, __pyx_v_indexer->size, __pyx_v_inout_args, 0, &__pyx_t_16); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "cupy/_core/_kernel.pyx":935
 *         kern.linear_launch(indexer.size, inout_args, shared_mem=0,
 *                            block_max_size=block_size, stream=stream)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple _decide_params_type(
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":832
 *         self.__name__ = name
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Compiles and invokes the elementwise kernel.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_kern);
  __Pyx_XDECREF(__pyx_v_in_args);
  __Pyx_XDECREF(__pyx_v_out_args);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_out_types);
  __Pyx_XDECREF(__pyx_v_stream);
  __Pyx_XDECREF(__pyx_v_block_size);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_arg_list);
  __Pyx_XDECREF(__pyx_v_in_ndarray_types);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_out_ndarray_types);
  __Pyx_XDECREF(__pyx_v_type_map);
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_inout_args);
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF(__pyx_v_arginfos);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":937
 *         return ret
 * 
 *     cpdef tuple _decide_params_type(             # <<<<<<<<<<<<<<
 *             self, tuple in_args_dtype, tuple out_args_dtype):
 *         key = (in_args_dtype, out_args_dtype)
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5_decide_params_type(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__decide_params_type(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decide_params_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_decide_params_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5_decide_params_type)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_in_args_dtype, __pyx_v_out_args_dtype};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 937, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":939
 *     cpdef tuple _decide_params_type(
 *             self, tuple in_args_dtype, tuple out_args_dtype):
 *         key = (in_args_dtype, out_args_dtype)             # <<<<<<<<<<<<<<
 *         ret = self._params_type_memo.get(key, None)
 *         if ret is not None:
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_in_args_dtype);
  __Pyx_GIVEREF(__pyx_v_in_args_dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_in_args_dtype) != (0)) __PYX_ERR(0, 939, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_out_args_dtype);
  __Pyx_GIVEREF(__pyx_v_out_args_dtype);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_out_args_dtype) != (0)) __PYX_ERR(0, 939, __pyx_L1_error);
  __pyx_v_key = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":940
 *             self, tuple in_args_dtype, tuple out_args_dtype):
 *         key = (in_args_dtype, out_args_dtype)
 *         ret = self._params_type_memo.get(key, None)             # <<<<<<<<<<<<<<
 *         if ret is not None:
 *             return ret
*/
  if (unlikely(__pyx_v_self->_params_type_memo == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 940, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_params_type_memo, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":941
 *         key = (in_args_dtype, out_args_dtype)
 *         ret = self._params_type_memo.get(key, None)
 *         if ret is not None:             # <<<<<<<<<<<<<<
 *             return ret
 *         ret = _decide_params_type_core(
*/
  __pyx_t_6 = (__pyx_v_ret != Py_None);
  if (__pyx_t_6) {

    /* "cupy/_core/_kernel.pyx":942
 *         ret = self._params_type_memo.get(key, None)
 *         if ret is not None:
 *             return ret             # <<<<<<<<<<<<<<
 *         ret = _decide_params_type_core(
 *             self.in_params, self.out_params, in_args_dtype, out_args_dtype)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_v_ret;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 942, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":941
 *         key = (in_args_dtype, out_args_dtype)
 *         ret = self._params_type_memo.get(key, None)
 *         if ret is not None:             # <<<<<<<<<<<<<<
 *             return ret
 *         ret = _decide_params_type_core(
*/
  }

  /* "cupy/_core/_kernel.pyx":944
 *             return ret
 *         ret = _decide_params_type_core(
 *             self.in_params, self.out_params, in_args_dtype, out_args_dtype)             # <<<<<<<<<<<<<<
 *         self._params_type_memo[key] = ret
 *         return ret
*/
  __pyx_t_1 = __pyx_v_self->in_params;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_self->out_params;
  __Pyx_INCREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":943
 *         if ret is not None:
 *             return ret
 *         ret = _decide_params_type_core(             # <<<<<<<<<<<<<<
 *             self.in_params, self.out_params, in_args_dtype, out_args_dtype)
 *         self._params_type_memo[key] = ret
*/
  __pyx_t_4 = __pyx_f_4cupy_5_core_7_kernel__decide_params_type_core(((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2), __pyx_v_in_args_dtype, __pyx_v_out_args_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cupy/_core/_kernel.pyx":945
 *         ret = _decide_params_type_core(
 *             self.in_params, self.out_params, in_args_dtype, out_args_dtype)
 *         self._params_type_memo[key] = ret             # <<<<<<<<<<<<<<
 *         return ret
 * 
*/
  if (unlikely(__pyx_v_self->_params_type_memo == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 945, __pyx_L1_error)
  }
  if (unlikely((PyDict_SetItem(__pyx_v_self->_params_type_memo, __pyx_v_key, __pyx_v_ret) < 0))) __PYX_ERR(0, 945, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":946
 *             self.in_params, self.out_params, in_args_dtype, out_args_dtype)
 *         self._params_type_memo[key] = ret
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cpdef function.Function _get_elementwise_kernel(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_v_ret;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_4))) __PYX_ERR(0, 946, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":937
 *         return ret
 * 
 *     cpdef tuple _decide_params_type(             # <<<<<<<<<<<<<<
 *             self, tuple in_args_dtype, tuple out_args_dtype):
 *         key = (in_args_dtype, out_args_dtype)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._decide_params_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5_decide_params_type(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_4_decide_params_type, "ElementwiseKernel._decide_params_type(self, tuple in_args_dtype, tuple out_args_dtype) -> tuple");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5_decide_params_type(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_in_args_dtype = 0;
  PyObject *__pyx_v_out_args_dtype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_decide_params_type (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_args_dtype,&__pyx_mstate_global->__pyx_n_u_out_args_dtype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 937, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 937, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 937, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_decide_params_type", 0) < (0)) __PYX_ERR(0, 937, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_decide_params_type", 1, 2, 2, i); __PYX_ERR(0, 937, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 937, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 937, __pyx_L3_error)
    }
    __pyx_v_in_args_dtype = ((PyObject*)values[0]);
    __pyx_v_out_args_dtype = ((PyObject*)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_decide_params_type", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 937, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._decide_params_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_args_dtype), (&PyTuple_Type), 1, "in_args_dtype", 1))) __PYX_ERR(0, 938, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_args_dtype), (&PyTuple_Type), 1, "out_args_dtype", 1))) __PYX_ERR(0, 938, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4_decide_params_type(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self), __pyx_v_in_args_dtype, __pyx_v_out_args_dtype);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4_decide_params_type(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v_in_args_dtype, PyObject *__pyx_v_out_args_dtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_decide_params_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__decide_params_type(__pyx_v_self, __pyx_v_in_args_dtype, __pyx_v_out_args_dtype, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._decide_params_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":948
 *         return ret
 * 
 *     cpdef function.Function _get_elementwise_kernel(             # <<<<<<<<<<<<<<
 *             self, int dev_id, tuple arginfos, _TypeMap type_map):
 *         key = (
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_7_get_elementwise_kernel(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__get_elementwise_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, int __pyx_v_dev_id, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_kern = NULL;
  PyObject *__pyx_v_in_types = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_code = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_elementwise_kernel", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_7_get_elementwise_kernel)) {
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_dev_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_t_5, __pyx_v_arginfos, ((PyObject *)__pyx_v_type_map)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 948, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":951
 *             self, int dev_id, tuple arginfos, _TypeMap type_map):
 *         key = (
 *             dev_id,             # <<<<<<<<<<<<<<
 *             arginfos,
 *             type_map)
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dev_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cupy/_core/_kernel.pyx":953
 *             dev_id,
 *             arginfos,
 *             type_map)             # <<<<<<<<<<<<<<
 *         kern = self._elementwise_kernel_memo.get(key, None)
 *         if kern is not None:
*/
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 951, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_arginfos);
  __Pyx_GIVEREF(__pyx_v_arginfos);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_arginfos) != (0)) __PYX_ERR(0, 951, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_type_map);
  __Pyx_GIVEREF((PyObject *)__pyx_v_type_map);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_type_map)) != (0)) __PYX_ERR(0, 951, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_v_key = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":954
 *             arginfos,
 *             type_map)
 *         kern = self._elementwise_kernel_memo.get(key, None)             # <<<<<<<<<<<<<<
 *         if kern is not None:
 *             return kern
*/
  if (unlikely(__pyx_v_self->_elementwise_kernel_memo == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 954, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_elementwise_kernel_memo, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_kern = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":955
 *             type_map)
 *         kern = self._elementwise_kernel_memo.get(key, None)
 *         if kern is not None:             # <<<<<<<<<<<<<<
 *             return kern
 *         kern = _get_elementwise_kernel(
*/
  __pyx_t_7 = (__pyx_v_kern != Py_None);
  if (__pyx_t_7) {

    /* "cupy/_core/_kernel.pyx":956
 *         kern = self._elementwise_kernel_memo.get(key, None)
 *         if kern is not None:
 *             return kern             # <<<<<<<<<<<<<<
 *         kern = _get_elementwise_kernel(
 *             arginfos, type_map, self.params, self.operation,
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_kern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_kern, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_kern);
    __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_v_kern);
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":955
 *             type_map)
 *         kern = self._elementwise_kernel_memo.get(key, None)
 *         if kern is not None:             # <<<<<<<<<<<<<<
 *             return kern
 *         kern = _get_elementwise_kernel(
*/
  }

  /* "cupy/_core/_kernel.pyx":957
 *         if kern is not None:
 *             return kern
 *         kern = _get_elementwise_kernel(             # <<<<<<<<<<<<<<
 *             arginfos, type_map, self.params, self.operation,
 *             self.name, self.preamble, **self.kwargs)
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "cupy/_core/_kernel.pyx":959
 *         kern = _get_elementwise_kernel(
 *             arginfos, type_map, self.params, self.operation,
 *             self.name, self.preamble, **self.kwargs)             # <<<<<<<<<<<<<<
 * 
 *         # Store the compiled kernel in the cache.
*/
  if (unlikely(__pyx_v_self->kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 959, __pyx_L1_error)
  }
  __pyx_t_5 = PyDict_Copy(__pyx_v_self->kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[7] = {__pyx_t_1, __pyx_v_arginfos, ((PyObject *)__pyx_v_type_map), __pyx_v_self->params, __pyx_v_self->operation, __pyx_v_self->name, __pyx_v_self->preamble};
    __pyx_t_2 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (7-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF_SET(__pyx_v_kern, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":964
 *         # Potentially overwrite a duplicate cache entry because
 *         # _get_elementwise_kernel() may include IO wait.
 *         in_types = []             # <<<<<<<<<<<<<<
 *         for x in arginfos:
 *             if x.type is cupy.ndarray:
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_in_types = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":965
 *         # _get_elementwise_kernel() may include IO wait.
 *         in_types = []
 *         for x in arginfos:             # <<<<<<<<<<<<<<
 *             if x.type is cupy.ndarray:
 *                 in_types.append(cupy.dtype(x.dtype))
*/
  if (unlikely(__pyx_v_arginfos == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 965, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_arginfos; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_8 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 965, __pyx_L1_error)
      #endif
      if (__pyx_t_8 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
    #endif
    ++__pyx_t_8;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":966
 *         in_types = []
 *         for x in arginfos:
 *             if x.type is cupy.ndarray:             # <<<<<<<<<<<<<<
 *                 in_types.append(cupy.dtype(x.dtype))
 *         in_types = tuple(in_types)
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_cupy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = (__pyx_t_4 == __pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "cupy/_core/_kernel.pyx":967
 *         for x in arginfos:
 *             if x.type is cupy.ndarray:
 *                 in_types.append(cupy.dtype(x.dtype))             # <<<<<<<<<<<<<<
 *         in_types = tuple(in_types)
 *         if in_types not in self._cached_codes:
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_cupy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_in_types, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 967, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "cupy/_core/_kernel.pyx":966
 *         in_types = []
 *         for x in arginfos:
 *             if x.type is cupy.ndarray:             # <<<<<<<<<<<<<<
 *                 in_types.append(cupy.dtype(x.dtype))
 *         in_types = tuple(in_types)
*/
    }

    /* "cupy/_core/_kernel.pyx":965
 *         # _get_elementwise_kernel() may include IO wait.
 *         in_types = []
 *         for x in arginfos:             # <<<<<<<<<<<<<<
 *             if x.type is cupy.ndarray:
 *                 in_types.append(cupy.dtype(x.dtype))
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":968
 *             if x.type is cupy.ndarray:
 *                 in_types.append(cupy.dtype(x.dtype))
 *         in_types = tuple(in_types)             # <<<<<<<<<<<<<<
 *         if in_types not in self._cached_codes:
 *             code = _get_elementwise_kernel_code(
*/
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_v_in_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_in_types, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":969
 *                 in_types.append(cupy.dtype(x.dtype))
 *         in_types = tuple(in_types)
 *         if in_types not in self._cached_codes:             # <<<<<<<<<<<<<<
 *             code = _get_elementwise_kernel_code(
 *                 arginfos, type_map, self.params, self.operation,
*/
  if (unlikely(__pyx_v_self->_cached_codes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 969, __pyx_L1_error)
  }
  __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_v_in_types, __pyx_v_self->_cached_codes, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 969, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "cupy/_core/_kernel.pyx":970
 *         in_types = tuple(in_types)
 *         if in_types not in self._cached_codes:
 *             code = _get_elementwise_kernel_code(             # <<<<<<<<<<<<<<
 *                 arginfos, type_map, self.params, self.operation,
 *                 self.name, self.preamble, **self.kwargs)
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "cupy/_core/_kernel.pyx":972
 *             code = _get_elementwise_kernel_code(
 *                 arginfos, type_map, self.params, self.operation,
 *                 self.name, self.preamble, **self.kwargs)             # <<<<<<<<<<<<<<
 *             self._cached_codes[in_types] = code
 *         kern = self._elementwise_kernel_memo.setdefault(key, kern)
*/
    if (unlikely(__pyx_v_self->kwargs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 972, __pyx_L1_error)
    }
    __pyx_t_5 = PyDict_Copy(__pyx_v_self->kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[7] = {__pyx_t_1, __pyx_v_arginfos, ((PyObject *)__pyx_v_type_map), __pyx_v_self->params, __pyx_v_self->operation, __pyx_v_self->name, __pyx_v_self->preamble};
      __pyx_t_2 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (7-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_code = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":973
 *                 arginfos, type_map, self.params, self.operation,
 *                 self.name, self.preamble, **self.kwargs)
 *             self._cached_codes[in_types] = code             # <<<<<<<<<<<<<<
 *         kern = self._elementwise_kernel_memo.setdefault(key, kern)
 *         return kern
*/
    if (unlikely(__pyx_v_self->_cached_codes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 973, __pyx_L1_error)
    }
    if (unlikely((PyDict_SetItem(__pyx_v_self->_cached_codes, __pyx_v_in_types, __pyx_v_code) < 0))) __PYX_ERR(0, 973, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":969
 *                 in_types.append(cupy.dtype(x.dtype))
 *         in_types = tuple(in_types)
 *         if in_types not in self._cached_codes:             # <<<<<<<<<<<<<<
 *             code = _get_elementwise_kernel_code(
 *                 arginfos, type_map, self.params, self.operation,
*/
  }

  /* "cupy/_core/_kernel.pyx":974
 *                 self.name, self.preamble, **self.kwargs)
 *             self._cached_codes[in_types] = code
 *         kern = self._elementwise_kernel_memo.setdefault(key, kern)             # <<<<<<<<<<<<<<
 *         return kern
 * 
*/
  if (unlikely(__pyx_v_self->_elementwise_kernel_memo == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault");
    __PYX_ERR(0, 974, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyDict_SetDefault(__pyx_v_self->_elementwise_kernel_memo, __pyx_v_key, __pyx_v_kern); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_kern, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":975
 *             self._cached_codes[in_types] = code
 *         kern = self._elementwise_kernel_memo.setdefault(key, kern)
 *         return kern             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  if (!(likely(((__pyx_v_kern) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_kern, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_kern);
  __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_v_kern);
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":948
 *         return ret
 * 
 *     cpdef function.Function _get_elementwise_kernel(             # <<<<<<<<<<<<<<
 *             self, int dev_id, tuple arginfos, _TypeMap type_map):
 *         key = (
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._get_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_kern);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_7_get_elementwise_kernel(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_6_get_elementwise_kernel, "ElementwiseKernel._get_elementwise_kernel(self, int dev_id, tuple arginfos, _TypeMap type_map) -> Function");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_7_get_elementwise_kernel(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  int __pyx_v_dev_id;
  PyObject *__pyx_v_arginfos = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_elementwise_kernel (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dev_id,&__pyx_mstate_global->__pyx_n_u_arginfos,&__pyx_mstate_global->__pyx_n_u_type_map,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 948, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_elementwise_kernel", 0) < (0)) __PYX_ERR(0, 948, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel", 1, 3, 3, i); __PYX_ERR(0, 948, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 948, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 948, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 948, __pyx_L3_error)
    }
    __pyx_v_dev_id = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_dev_id == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)
    __pyx_v_arginfos = ((PyObject*)values[1]);
    __pyx_v_type_map = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_elementwise_kernel", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 948, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._get_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arginfos), (&PyTuple_Type), 1, "arginfos", 1))) __PYX_ERR(0, 949, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_type_map), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, 1, "type_map", 0))) __PYX_ERR(0, 949, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6_get_elementwise_kernel(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self), __pyx_v_dev_id, __pyx_v_arginfos, __pyx_v_type_map);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6_get_elementwise_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, int __pyx_v_dev_id, PyObject *__pyx_v_arginfos, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_elementwise_kernel", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__get_elementwise_kernel(__pyx_v_self, __pyx_v_dev_id, __pyx_v_arginfos, __pyx_v_type_map, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel._get_elementwise_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":977
 *         return kern
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cached_codes(self):
 *         """Returns a dict that has input types as keys and codes values.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "cupy/_core/_kernel.pyx":984
 *         The return value is not guaranteed to keep backward compatibility.
 *         """
 *         if len(self._cached_codes) == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 'No codes are cached because compilation is deferred until '
*/
  __pyx_t_1 = __pyx_v_self->_cached_codes;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 984, __pyx_L1_error)
  }
  __pyx_t_2 = PyDict_Size(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 == 0);
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":985
 *         """
 *         if len(self._cached_codes) == 0:
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 'No codes are cached because compilation is deferred until '
 *                 'the first function call.')
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_No_codes_are_cached_because_comp};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":984
 *         The return value is not guaranteed to keep backward compatibility.
 *         """
 *         if len(self._cached_codes) == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 'No codes are cached because compilation is deferred until '
*/
  }

  /* "cupy/_core/_kernel.pyx":988
 *                 'No codes are cached because compilation is deferred until '
 *                 'the first function call.')
 *         return dict(self._cached_codes.items())             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = NULL;
  if (unlikely(__pyx_v_self->_cached_codes == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 988, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyDict_Items(__pyx_v_self->_cached_codes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":977
 *         return kern
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cached_codes(self):
 *         """Returns a dict that has input types as keys and codes values.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.cached_codes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":990
 *         return dict(self._cached_codes.items())
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cached_code(self):
 *         """Returns `next(iter(self.cached_codes.values()))`.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_v_codes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "cupy/_core/_kernel.pyx":997
 *         The return value is not guaranteed to keep backward compatibility.
 *         """
 *         codes = self._cached_codes             # <<<<<<<<<<<<<<
 *         if len(codes) > 1:
 *             warnings.warn(
*/
  __pyx_t_1 = __pyx_v_self->_cached_codes;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_codes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":998
 *         """
 *         codes = self._cached_codes
 *         if len(codes) > 1:             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 'The input types of the kernel could not be inferred. '
*/
  if (unlikely(__pyx_v_codes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 998, __pyx_L1_error)
  }
  __pyx_t_2 = PyDict_Size(__pyx_v_codes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 998, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 > 1);
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":999
 *         codes = self._cached_codes
 *         if len(codes) > 1:
 *             warnings.warn(             # <<<<<<<<<<<<<<
 *                 'The input types of the kernel could not be inferred. '
 *                 'Please use `.cached_codes` instead.')
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_The_input_types_of_the_kernel_co};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 999, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":998
 *         """
 *         codes = self._cached_codes
 *         if len(codes) > 1:             # <<<<<<<<<<<<<<
 *             warnings.warn(
 *                 'The input types of the kernel could not be inferred. '
*/
  }

  /* "cupy/_core/_kernel.pyx":1002
 *                 'The input types of the kernel could not be inferred. '
 *                 'Please use `.cached_codes` instead.')
 *         return next(iter(codes.values()))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_codes == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
    __PYX_ERR(0, 1002, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Values(__pyx_v_codes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyIter_Next(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":990
 *         return dict(self._cached_codes.items())
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def cached_code(self):
 *         """Returns `next(iter(self.cached_codes.values()))`.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.cached_code.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_codes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":784
 * 
 *     cdef:
 *         readonly tuple in_params             # <<<<<<<<<<<<<<
 *         readonly tuple out_params
 *         readonly Py_ssize_t nin
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->in_params);
  __pyx_r = __pyx_v_self->in_params;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":785
 *     cdef:
 *         readonly tuple in_params
 *         readonly tuple out_params             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nin
 *         readonly Py_ssize_t nout
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->out_params);
  __pyx_r = __pyx_v_self->out_params;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":786
 *         readonly tuple in_params
 *         readonly tuple out_params
 *         readonly Py_ssize_t nin             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.nin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":787
 *         readonly tuple out_params
 *         readonly Py_ssize_t nin
 *         readonly Py_ssize_t nout             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nargs
 *         readonly tuple params
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.nout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":788
 *         readonly Py_ssize_t nin
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs             # <<<<<<<<<<<<<<
 *         readonly tuple params
 *         readonly object operation
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.nargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":789
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs
 *         readonly tuple params             # <<<<<<<<<<<<<<
 *         readonly object operation
 *         readonly str name
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6params_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6params_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6params___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->params);
  __pyx_r = __pyx_v_self->params;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":790
 *         readonly Py_ssize_t nargs
 *         readonly tuple params
 *         readonly object operation             # <<<<<<<<<<<<<<
 *         readonly str name
 *         readonly str __name__
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->operation);
  __pyx_r = __pyx_v_self->operation;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":791
 *         readonly tuple params
 *         readonly object operation
 *         readonly str name             # <<<<<<<<<<<<<<
 *         readonly str __name__
 *         readonly bint reduce_dims
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4name___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":792
 *         readonly object operation
 *         readonly str name
 *         readonly str __name__             # <<<<<<<<<<<<<<
 *         readonly bint reduce_dims
 *         readonly object preamble
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name___1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name_____get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->__pyx___name__);
  __pyx_r = __pyx_v_self->__pyx___name__;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":793
 *         readonly str name
 *         readonly str __name__
 *         readonly bint reduce_dims             # <<<<<<<<<<<<<<
 *         readonly object preamble
 *         readonly bint no_return
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->reduce_dims); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.reduce_dims.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":794
 *         readonly str __name__
 *         readonly bint reduce_dims
 *         readonly object preamble             # <<<<<<<<<<<<<<
 *         readonly bint no_return
 *         readonly bint return_tuple
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->preamble);
  __pyx_r = __pyx_v_self->preamble;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":795
 *         readonly bint reduce_dims
 *         readonly object preamble
 *         readonly bint no_return             # <<<<<<<<<<<<<<
 *         readonly bint return_tuple
 *         readonly dict kwargs
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_return); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.no_return.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":796
 *         readonly object preamble
 *         readonly bint no_return
 *         readonly bint return_tuple             # <<<<<<<<<<<<<<
 *         readonly dict kwargs
 *         readonly dict _params_type_memo
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->return_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.return_tuple.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":797
 *         readonly bint no_return
 *         readonly bint return_tuple
 *         readonly dict kwargs             # <<<<<<<<<<<<<<
 *         readonly dict _params_type_memo
 *         readonly dict _elementwise_kernel_memo
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->kwargs);
  __pyx_r = __pyx_v_self->kwargs;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":798
 *         readonly bint return_tuple
 *         readonly dict kwargs
 *         readonly dict _params_type_memo             # <<<<<<<<<<<<<<
 *         readonly dict _elementwise_kernel_memo
 *         readonly dict _cached_codes
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_params_type_memo);
  __pyx_r = __pyx_v_self->_params_type_memo;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":799
 *         readonly dict kwargs
 *         readonly dict _params_type_memo
 *         readonly dict _elementwise_kernel_memo             # <<<<<<<<<<<<<<
 *         readonly dict _cached_codes
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_elementwise_kernel_memo);
  __pyx_r = __pyx_v_self->_elementwise_kernel_memo;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":800
 *         readonly dict _params_type_memo
 *         readonly dict _elementwise_kernel_memo
 *         readonly dict _cached_codes             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, in_params, out_params, operation,
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_cached_codes);
  __pyx_r = __pyx_v_self->_cached_codes;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_8__reduce_cython__, "ElementwiseKernel.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.__name__, self._cached_codes, self._elementwise_kernel_memo, self._params_type_memo, self.in_params, self.kwargs, self.name, self.nargs, self.nin, self.no_return, self.nout, self.operation, self.out_params, self.params, self.preamble, self.reduce_dims, self.return_tuple)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->no_return); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_self->nout); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->reduce_dims); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->return_tuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(17); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_self->__pyx___name__);
  __Pyx_GIVEREF(__pyx_v_self->__pyx___name__);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->__pyx___name__) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_cached_codes);
  __Pyx_GIVEREF(__pyx_v_self->_cached_codes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_self->_cached_codes) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_elementwise_kernel_memo);
  __Pyx_GIVEREF(__pyx_v_self->_elementwise_kernel_memo);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_self->_elementwise_kernel_memo) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_params_type_memo);
  __Pyx_GIVEREF(__pyx_v_self->_params_type_memo);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_self->_params_type_memo) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->in_params);
  __Pyx_GIVEREF(__pyx_v_self->in_params);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_self->in_params) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->kwargs);
  __Pyx_GIVEREF(__pyx_v_self->kwargs);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_v_self->kwargs) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_v_self->name) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 7, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 8, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 9, __pyx_t_3) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 10, __pyx_t_4) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->operation);
  __Pyx_GIVEREF(__pyx_v_self->operation);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 11, __pyx_v_self->operation) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->out_params);
  __Pyx_GIVEREF(__pyx_v_self->out_params);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 12, __pyx_v_self->out_params) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->params);
  __Pyx_GIVEREF(__pyx_v_self->params);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 13, __pyx_v_self->params) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->preamble);
  __Pyx_GIVEREF(__pyx_v_self->preamble);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 14, __pyx_v_self->preamble) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 15, __pyx_t_5) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 16, __pyx_t_6) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.__name__, self._cached_codes, self._elementwise_kernel_memo, self._params_type_memo, self.in_params, self.kwargs, self.name, self.nargs, self.nin, self.no_return, self.nout, self.operation, self.out_params, self.params, self.preamble, self.reduce_dims, self.return_tuple)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_7 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v__dict = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "(tree fragment)":7
 *     state = (self.__name__, self._cached_codes, self._elementwise_kernel_memo, self._params_type_memo, self.in_params, self.kwargs, self.name, self.nargs, self.nin, self.no_return, self.nout, self.operation, self.out_params, self.params, self.preamble, self.reduce_dims, self.return_tuple)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_9 = (__pyx_v__dict != Py_None);
  if (__pyx_t_9) {
  } else {
    __pyx_t_8 = __pyx_t_9;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_8 = __pyx_t_9;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_8) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.__name__ is not None or self._cached_codes is not None or self._elementwise_kernel_memo is not None or self._params_type_memo is not None or self.in_params is not None or self.kwargs is not None or self.name is not None or self.operation is not None or self.out_params is not None or self.params is not None or self.preamble is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.__name__, self._cached_codes, self._elementwise_kernel_memo, self._params_type_memo, self.in_params, self.kwargs, self.name, self.nargs, self.nin, self.no_return, self.nout, self.operation, self.out_params, self.params, self.preamble, self.reduce_dims, self.return_tuple)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.__name__ is not None or self._cached_codes is not None or self._elementwise_kernel_memo is not None or self._params_type_memo is not None or self.in_params is not None or self.kwargs is not None or self.name is not None or self.operation is not None or self.out_params is not None or self.params is not None or self.preamble is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, None), state
*/
  /*else*/ {
    __pyx_t_9 = (__pyx_v_self->__pyx___name__ != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->_cached_codes != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->_elementwise_kernel_memo != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->_params_type_memo != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->in_params != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->kwargs != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->name != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->operation != Py_None);
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->out_params != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->params != ((PyObject*)Py_None));
    if (!__pyx_t_9) {
    } else {
      __pyx_t_8 = __pyx_t_9;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = (__pyx_v_self->preamble != Py_None);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_8;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.__name__ is not None or self._cached_codes is not None or self._elementwise_kernel_memo is not None or self._params_type_memo is not None or self.in_params is not None or self.kwargs is not None or self.name is not None or self.operation is not None or self.out_params is not None or self.params is not None or self.preamble is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.__name__ is not None or self._cached_codes is not None or self._elementwise_kernel_memo is not None or self._params_type_memo is not None or self.in_params is not None or self.kwargs is not None or self.name is not None or self.operation is not None or self.out_params is not None or self.params is not None or self.preamble is not None
 *     if use_setstate:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ElementwiseKernel); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_129642355);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_129642355);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_mstate_global->__pyx_int_129642355) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_7);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.__name__ is not None or self._cached_codes is not None or self._elementwise_kernel_memo is not None or self._params_type_memo is not None or self.in_params is not None or self.kwargs is not None or self.name is not None or self.operation is not None or self.out_params is not None or self.params is not None or self.preamble is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, None), state
 *     else:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ElementwiseKernel__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ElementwiseKernel); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_129642355);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_129642355);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_mstate_global->__pyx_int_129642355) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_7);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ElementwiseKernel__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_10__setstate_cython__, "ElementwiseKernel.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_17ElementwiseKernel_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ElementwiseKernel__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ElementwiseKernel__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ElementwiseKernel, (type(self), 0x7ba2f73, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ElementwiseKernel__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel.ElementwiseKernel.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1005
 * 
 * 
 * cdef str fix_cast_expr(src_type, dst_type, str expr):             # <<<<<<<<<<<<<<
 *     src_kind = get_dtype(src_type).kind
 *     dst_kind = get_dtype(dst_type).kind
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_fix_cast_expr(PyObject *__pyx_v_src_type, PyObject *__pyx_v_dst_type, PyObject *__pyx_v_expr) {
  PyObject *__pyx_v_src_kind = NULL;
  PyObject *__pyx_v_dst_kind = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4[3];
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fix_cast_expr", 0);

  /* "cupy/_core/_kernel.pyx":1006
 * 
 * cdef str fix_cast_expr(src_type, dst_type, str expr):
 *     src_kind = get_dtype(src_type).kind             # <<<<<<<<<<<<<<
 *     dst_kind = get_dtype(dst_type).kind
 *     if src_kind == dst_kind:
*/
  __pyx_t_1 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_src_type, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_kind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_src_kind = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1007
 * cdef str fix_cast_expr(src_type, dst_type, str expr):
 *     src_kind = get_dtype(src_type).kind
 *     dst_kind = get_dtype(dst_type).kind             # <<<<<<<<<<<<<<
 *     if src_kind == dst_kind:
 *         return expr
*/
  __pyx_t_2 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_dst_type, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_kind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dst_kind = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1008
 *     src_kind = get_dtype(src_type).kind
 *     dst_kind = get_dtype(dst_type).kind
 *     if src_kind == dst_kind:             # <<<<<<<<<<<<<<
 *         return expr
 *     if src_kind == 'b':
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_src_kind, __pyx_v_dst_kind, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1009
 *     dst_kind = get_dtype(dst_type).kind
 *     if src_kind == dst_kind:
 *         return expr             # <<<<<<<<<<<<<<
 *     if src_kind == 'b':
 *         # HIP has an issue with bool conversions detailed below
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_expr);
    __pyx_r = __pyx_v_expr;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1008
 *     src_kind = get_dtype(src_type).kind
 *     dst_kind = get_dtype(dst_type).kind
 *     if src_kind == dst_kind:             # <<<<<<<<<<<<<<
 *         return expr
 *     if src_kind == 'b':
*/
  }

  /* "cupy/_core/_kernel.pyx":1010
 *     if src_kind == dst_kind:
 *         return expr
 *     if src_kind == 'b':             # <<<<<<<<<<<<<<
 *         # HIP has an issue with bool conversions detailed below
 *         if runtime._is_hip_environment:
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_src_kind, __pyx_mstate_global->__pyx_n_u_b, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1010, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1012
 *     if src_kind == 'b':
 *         # HIP has an issue with bool conversions detailed below
 *         if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *             return f'_hip_bool_cast({expr})'
 *         else:
*/
    if (__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment) {

      /* "cupy/_core/_kernel.pyx":1013
 *         # HIP has an issue with bool conversions detailed below
 *         if runtime._is_hip_environment:
 *             return f'_hip_bool_cast({expr})'             # <<<<<<<<<<<<<<
 *         else:
 *             return f'({expr}) ? 1 : 0'
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_expr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_hip_bool_cast;
      __pyx_t_4[1] = __pyx_t_1;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__11;
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1));
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":1012
 *     if src_kind == 'b':
 *         # HIP has an issue with bool conversions detailed below
 *         if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *             return f'_hip_bool_cast({expr})'
 *         else:
*/
    }

    /* "cupy/_core/_kernel.pyx":1015
 *             return f'_hip_bool_cast({expr})'
 *         else:
 *             return f'({expr}) ? 1 : 0'             # <<<<<<<<<<<<<<
 *     if src_kind == 'c':
 *         if dst_kind == 'b':
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_expr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1015, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u__12;
      __pyx_t_4[1] = __pyx_t_2;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_1_0;
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 9, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "cupy/_core/_kernel.pyx":1010
 *     if src_kind == dst_kind:
 *         return expr
 *     if src_kind == 'b':             # <<<<<<<<<<<<<<
 *         # HIP has an issue with bool conversions detailed below
 *         if runtime._is_hip_environment:
*/
  }

  /* "cupy/_core/_kernel.pyx":1016
 *         else:
 *             return f'({expr}) ? 1 : 0'
 *     if src_kind == 'c':             # <<<<<<<<<<<<<<
 *         if dst_kind == 'b':
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_src_kind, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1016, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1017
 *             return f'({expr}) ? 1 : 0'
 *     if src_kind == 'c':
 *         if dst_kind == 'b':             # <<<<<<<<<<<<<<
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'
 *         else:  # dst_kind in 'iuf' (int, uint, float)
*/
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_dst_kind, __pyx_mstate_global->__pyx_n_u_b, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1017, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":1018
 *     if src_kind == 'c':
 *         if dst_kind == 'b':
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'             # <<<<<<<<<<<<<<
 *         else:  # dst_kind in 'iuf' (int, uint, float)
 *             return f'({expr}).real()'
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_expr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1018, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_f_4cupy_5_core_7_scalar_get_typename(__pyx_v_src_type, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1018, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__12;
      __pyx_t_6[1] = __pyx_t_1;
      __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__13;
      __pyx_t_6[3] = __pyx_t_5;
      __pyx_t_6[4] = __pyx_mstate_global->__pyx_kp_u__14;
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":1017
 *             return f'({expr}) ? 1 : 0'
 *     if src_kind == 'c':
 *         if dst_kind == 'b':             # <<<<<<<<<<<<<<
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'
 *         else:  # dst_kind in 'iuf' (int, uint, float)
*/
    }

    /* "cupy/_core/_kernel.pyx":1020
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'
 *         else:  # dst_kind in 'iuf' (int, uint, float)
 *             return f'({expr}).real()'             # <<<<<<<<<<<<<<
 *     return expr
 * 
*/
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_expr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u__12;
      __pyx_t_4[1] = __pyx_t_2;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_real;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1020, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }

    /* "cupy/_core/_kernel.pyx":1016
 *         else:
 *             return f'({expr}) ? 1 : 0'
 *     if src_kind == 'c':             # <<<<<<<<<<<<<<
 *         if dst_kind == 'b':
 *             return f'({expr}) != {_scalar.get_typename(src_type)}()'
*/
  }

  /* "cupy/_core/_kernel.pyx":1021
 *         else:  # dst_kind in 'iuf' (int, uint, float)
 *             return f'({expr}).real()'
 *     return expr             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1005
 * 
 * 
 * cdef str fix_cast_expr(src_type, dst_type, str expr):             # <<<<<<<<<<<<<<
 *     src_kind = get_dtype(src_type).kind
 *     dst_kind = get_dtype(dst_type).kind
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel.fix_cast_expr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_src_kind);
  __Pyx_XDECREF(__pyx_v_dst_kind);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1024
 * 
 * 
 * cdef function.Function _get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *         tuple in_types, tuple out_types, routine, tuple arginfos,
 *         bint has_where, params,
*/

static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel__get_ufunc_kernel(PyObject *__pyx_v_in_types, PyObject *__pyx_v_out_types, PyObject *__pyx_v_routine, PyObject *__pyx_v_arginfos, int __pyx_v_has_where, PyObject *__pyx_v_params, PyObject *__pyx_v_name, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_arginfo = 0;
  PyObject *__pyx_v_str_type = 0;
  PyObject *__pyx_v_str_var = 0;
  Py_ssize_t __pyx_v_offset_where;
  PyObject *__pyx_v_offset_out = NULL;
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_v_op = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_out_op = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v_type_map = NULL;
  PyObject *__pyx_v_operation = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[3];
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  PyObject *__pyx_t_13[4];
  struct __pyx_opt_args_4cupy_5_core_7_kernel__get_simple_elementwise_kernel __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_ufunc_kernel", 0);
  __Pyx_INCREF(__pyx_v_preamble);

  /* "cupy/_core/_kernel.pyx":1031
 *     cdef str str_type, str_var
 * 
 *     offset_where = len(in_types)             # <<<<<<<<<<<<<<
 *     offset_out = offset_where
 *     if has_where:
*/
  if (unlikely(__pyx_v_in_types == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1031, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_in_types); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1031, __pyx_L1_error)
  __pyx_v_offset_where = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":1032
 * 
 *     offset_where = len(in_types)
 *     offset_out = offset_where             # <<<<<<<<<<<<<<
 *     if has_where:
 *         offset_out += 1
*/
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_offset_where); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_offset_out = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1033
 *     offset_where = len(in_types)
 *     offset_out = offset_where
 *     if has_where:             # <<<<<<<<<<<<<<
 *         offset_out += 1
 * 
*/
  if (__pyx_v_has_where) {

    /* "cupy/_core/_kernel.pyx":1034
 *     offset_out = offset_where
 *     if has_where:
 *         offset_out += 1             # <<<<<<<<<<<<<<
 * 
 *     types = []
*/
    __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_offset_out, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_offset_out, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1033
 *     offset_where = len(in_types)
 *     offset_out = offset_where
 *     if has_where:             # <<<<<<<<<<<<<<
 *         offset_out += 1
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1036
 *         offset_out += 1
 * 
 *     types = []             # <<<<<<<<<<<<<<
 *     op = []
 *     if has_where:
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_types = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1037
 * 
 *     types = []
 *     op = []             # <<<<<<<<<<<<<<
 *     if has_where:
 *         arginfo = arginfos[offset_where]
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_op = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1038
 *     types = []
 *     op = []
 *     if has_where:             # <<<<<<<<<<<<<<
 *         arginfo = arginfos[offset_where]
 *         if arginfo.is_ndarray():
*/
  if (__pyx_v_has_where) {

    /* "cupy/_core/_kernel.pyx":1039
 *     op = []
 *     if has_where:
 *         arginfo = arginfos[offset_where]             # <<<<<<<<<<<<<<
 *         if arginfo.is_ndarray():
 *             op.append('if(!_raw__where[_ind.get()]) continue;')
*/
    if (unlikely(__pyx_v_arginfos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1039, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_arginfos, __pyx_v_offset_where, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 1039, __pyx_L1_error)
    __pyx_v_arginfo = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1040
 *     if has_where:
 *         arginfo = arginfos[offset_where]
 *         if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *             op.append('if(!_raw__where[_ind.get()]) continue;')
 *         else:
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->is_ndarray(__pyx_v_arginfo);
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":1041
 *         arginfo = arginfos[offset_where]
 *         if arginfo.is_ndarray():
 *             op.append('if(!_raw__where[_ind.get()]) continue;')             # <<<<<<<<<<<<<<
 *         else:
 *             op.append('if(!_where) continue;')
*/
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_mstate_global->__pyx_kp_u_if__raw__where__ind_get_continue); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1041, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1040
 *     if has_where:
 *         arginfo = arginfos[offset_where]
 *         if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *             op.append('if(!_raw__where[_ind.get()]) continue;')
 *         else:
*/
      goto __pyx_L5;
    }

    /* "cupy/_core/_kernel.pyx":1043
 *             op.append('if(!_raw__where[_ind.get()]) continue;')
 *         else:
 *             op.append('if(!_where) continue;')             # <<<<<<<<<<<<<<
 *     for i, x in enumerate(in_types):
 *         str_var = 'in%d' % i
*/
    /*else*/ {
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_mstate_global->__pyx_kp_u_if__where_continue); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1043, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "cupy/_core/_kernel.pyx":1038
 *     types = []
 *     op = []
 *     if has_where:             # <<<<<<<<<<<<<<
 *         arginfo = arginfos[offset_where]
 *         if arginfo.is_ndarray():
*/
  }

  /* "cupy/_core/_kernel.pyx":1044
 *         else:
 *             op.append('if(!_where) continue;')
 *     for i, x in enumerate(in_types):             # <<<<<<<<<<<<<<
 *         str_var = 'in%d' % i
 *         str_type = str_var + '_type'
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  __pyx_t_5 = __pyx_v_in_types; __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1044, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1));
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1045
 *             op.append('if(!_where) continue;')
 *     for i, x in enumerate(in_types):
 *         str_var = 'in%d' % i             # <<<<<<<<<<<<<<
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))
*/
    __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_in_d, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_str_var, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1046
 *     for i, x in enumerate(in_types):
 *         str_var = 'in%d' % i
 *         str_type = str_var + '_type'             # <<<<<<<<<<<<<<
 *         types.append((str_type, x))
 *         arginfo = arginfos[i]
*/
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_v_str_var, __pyx_mstate_global->__pyx_n_u_type_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_str_type, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1047
 *         str_var = 'in%d' % i
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))             # <<<<<<<<<<<<<<
 *         arginfo = arginfos[i]
 *         if arginfo.is_ndarray():
*/
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_str_type);
    __Pyx_GIVEREF(__pyx_v_str_type);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_str_type) != (0)) __PYX_ERR(0, 1047, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_x) != (0)) __PYX_ERR(0, 1047, __pyx_L1_error);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_types, __pyx_t_6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1047, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1048
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))
 *         arginfo = arginfos[i]             # <<<<<<<<<<<<<<
 *         if arginfo.is_ndarray():
 *             op.append('const {} {}({});'.format(
*/
    if (unlikely(__pyx_v_arginfos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1048, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_arginfos, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arginfo, ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1049
 *         types.append((str_type, x))
 *         arginfo = arginfos[i]
 *         if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *             op.append('const {} {}({});'.format(
 *                 str_type,
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->is_ndarray(__pyx_v_arginfo);
    if (__pyx_t_3) {

      /* "cupy/_core/_kernel.pyx":1050
 *         arginfo = arginfos[i]
 *         if arginfo.is_ndarray():
 *             op.append('const {} {}({});'.format(             # <<<<<<<<<<<<<<
 *                 str_type,
 *                 str_var,
*/
      __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u_const_2;
      __Pyx_INCREF(__pyx_t_7);

      /* "cupy/_core/_kernel.pyx":1053
 *                 str_type,
 *                 str_var,
 *                 fix_cast_expr(arginfo.dtype, x, f'_raw_{str_var}[_ind.get()]')             # <<<<<<<<<<<<<<
 *             ))
 * 
*/
      __pyx_t_8 = __pyx_v_arginfo->dtype;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_9[0] = __pyx_mstate_global->__pyx_n_u_raw;
      __pyx_t_9[1] = __pyx_v_str_var;
      __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_ind_get;
      __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_str_var) + 12, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_str_var));
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __pyx_f_4cupy_5_core_7_kernel_fix_cast_expr(__pyx_t_8, __pyx_v_x, ((PyObject*)__pyx_t_10)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_str_type, __pyx_v_str_var, __pyx_t_11};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_12, (4-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1050, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }

      /* "cupy/_core/_kernel.pyx":1050
 *         arginfo = arginfos[i]
 *         if arginfo.is_ndarray():
 *             op.append('const {} {}({});'.format(             # <<<<<<<<<<<<<<
 *                 str_type,
 *                 str_var,
*/
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_t_6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cupy/_core/_kernel.pyx":1049
 *         types.append((str_type, x))
 *         arginfo = arginfos[i]
 *         if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *             op.append('const {} {}({});'.format(
 *                 str_type,
*/
    }

    /* "cupy/_core/_kernel.pyx":1044
 *         else:
 *             op.append('if(!_where) continue;')
 *     for i, x in enumerate(in_types):             # <<<<<<<<<<<<<<
 *         str_var = 'in%d' % i
 *         str_type = str_var + '_type'
*/
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1056
 *             ))
 * 
 *     out_op = []             # <<<<<<<<<<<<<<
 *     for i, x in enumerate(out_types):
 *         str_var = 'out%d' % i
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out_op = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1057
 * 
 *     out_op = []
 *     for i, x in enumerate(out_types):             # <<<<<<<<<<<<<<
 *         str_var = 'out%d' % i
 *         str_type = str_var + '_type'
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  __pyx_t_5 = __pyx_v_out_types; __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1057, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1));
    #else
    __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1058
 *     out_op = []
 *     for i, x in enumerate(out_types):
 *         str_var = 'out%d' % i             # <<<<<<<<<<<<<<
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))
*/
    __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_out_d, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_str_var, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1059
 *     for i, x in enumerate(out_types):
 *         str_var = 'out%d' % i
 *         str_type = str_var + '_type'             # <<<<<<<<<<<<<<
 *         types.append((str_type, x))
 *         arginfo = arginfos[i + offset_out]
*/
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_v_str_var, __pyx_mstate_global->__pyx_n_u_type_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_str_type, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1060
 *         str_var = 'out%d' % i
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))             # <<<<<<<<<<<<<<
 *         arginfo = arginfos[i + offset_out]
 *         op.append(f'{str_type} {str_var};')
*/
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_str_type);
    __Pyx_GIVEREF(__pyx_v_str_type);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_str_type) != (0)) __PYX_ERR(0, 1060, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_x) != (0)) __PYX_ERR(0, 1060, __pyx_L1_error);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_types, __pyx_t_6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1060, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1061
 *         str_type = str_var + '_type'
 *         types.append((str_type, x))
 *         arginfo = arginfos[i + offset_out]             # <<<<<<<<<<<<<<
 *         op.append(f'{str_type} {str_var};')
 *         out_op.append('{} = {};'.format(
*/
    if (unlikely(__pyx_v_arginfos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1061, __pyx_L1_error)
    }
    __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_offset_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_arginfos, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arginfo, ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_11));
    __pyx_t_11 = 0;

    /* "cupy/_core/_kernel.pyx":1062
 *         types.append((str_type, x))
 *         arginfo = arginfos[i + offset_out]
 *         op.append(f'{str_type} {str_var};')             # <<<<<<<<<<<<<<
 *         out_op.append('{} = {};'.format(
 *             f'_raw_{str_var}[_ind.get()]',
*/
    __pyx_t_13[0] = __pyx_v_str_type;
    __pyx_t_13[1] = __pyx_mstate_global->__pyx_kp_u__4;
    __pyx_t_13[2] = __pyx_v_str_var;
    __pyx_t_13[3] = __pyx_mstate_global->__pyx_kp_u__15;
    __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_13, 4, __Pyx_PyUnicode_GET_LENGTH(__pyx_v_str_type) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_str_var), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_str_type) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_str_var));
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_t_11); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1062, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "cupy/_core/_kernel.pyx":1063
 *         arginfo = arginfos[i + offset_out]
 *         op.append(f'{str_type} {str_var};')
 *         out_op.append('{} = {};'.format(             # <<<<<<<<<<<<<<
 *             f'_raw_{str_var}[_ind.get()]',
 *             fix_cast_expr(x, arginfo.dtype, str_var)
*/
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u__16;
    __Pyx_INCREF(__pyx_t_6);

    /* "cupy/_core/_kernel.pyx":1064
 *         op.append(f'{str_type} {str_var};')
 *         out_op.append('{} = {};'.format(
 *             f'_raw_{str_var}[_ind.get()]',             # <<<<<<<<<<<<<<
 *             fix_cast_expr(x, arginfo.dtype, str_var)
 *         ))
*/
    __pyx_t_9[0] = __pyx_mstate_global->__pyx_n_u_raw;
    __pyx_t_9[1] = __pyx_v_str_var;
    __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_ind_get;
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_v_str_var) + 12, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_str_var));
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "cupy/_core/_kernel.pyx":1065
 *         out_op.append('{} = {};'.format(
 *             f'_raw_{str_var}[_ind.get()]',
 *             fix_cast_expr(x, arginfo.dtype, str_var)             # <<<<<<<<<<<<<<
 *         ))
 * 
*/
    __pyx_t_10 = __pyx_v_arginfo->dtype;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_8 = __pyx_f_4cupy_5_core_7_kernel_fix_cast_expr(__pyx_v_x, __pyx_t_10, __pyx_v_str_var); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_12 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_7, __pyx_t_8};
      __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_12, (3-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }

    /* "cupy/_core/_kernel.pyx":1063
 *         arginfo = arginfos[i + offset_out]
 *         op.append(f'{str_type} {str_var};')
 *         out_op.append('{} = {};'.format(             # <<<<<<<<<<<<<<
 *             f'_raw_{str_var}[_ind.get()]',
 *             fix_cast_expr(x, arginfo.dtype, str_var)
*/
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_out_op, __pyx_t_11); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "cupy/_core/_kernel.pyx":1057
 * 
 *     out_op = []
 *     for i, x in enumerate(out_types):             # <<<<<<<<<<<<<<
 *         str_var = 'out%d' % i
 *         str_type = str_var + '_type'
*/
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1068
 *         ))
 * 
 *     type_map = _TypeMap(tuple(types))             # <<<<<<<<<<<<<<
 * 
 *     op.append(routine)
*/
  __pyx_t_5 = NULL;
  __pyx_t_11 = PyList_AsTuple(__pyx_v_types); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_2);
  }
  __pyx_v_type_map = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1070
 *     type_map = _TypeMap(tuple(types))
 * 
 *     op.append(routine)             # <<<<<<<<<<<<<<
 *     op.append(';')
 *     op.extend(out_op)
*/
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_v_routine); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1070, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1071
 * 
 *     op.append(routine)
 *     op.append(';')             # <<<<<<<<<<<<<<
 *     op.extend(out_op)
 *     operation = '\n'.join(op)
*/
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_op, __pyx_mstate_global->__pyx_kp_u__15); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1071, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1072
 *     op.append(routine)
 *     op.append(';')
 *     op.extend(out_op)             # <<<<<<<<<<<<<<
 *     operation = '\n'.join(op)
 *     # HIP/ROCm 4.3 has an issue with ifs and ternary operators
*/
  __pyx_t_4 = __Pyx_PyList_Extend(__pyx_v_op, __pyx_v_out_op); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1072, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1073
 *     op.append(';')
 *     op.extend(out_op)
 *     operation = '\n'.join(op)             # <<<<<<<<<<<<<<
 *     # HIP/ROCm 4.3 has an issue with ifs and ternary operators
 *     #
*/
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__10, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_operation = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1086
 *     # also it simplifies  (a ? 1 : 0)  directly to a, and yields
 *     # an incorrect value
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         preamble += """
 *         __device__ int _hip_bool_cast(long long int x) {
*/
  if (__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment) {

    /* "cupy/_core/_kernel.pyx":1087
 *     # an incorrect value
 *     if runtime._is_hip_environment:
 *         preamble += """             # <<<<<<<<<<<<<<
 *         __device__ int _hip_bool_cast(long long int x) {
 *             volatile int a = 1;
*/
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_preamble, __pyx_mstate_global->__pyx_kp_u_device___int__hip_bool_cast_l); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_preamble, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1086
 *     # also it simplifies  (a ? 1 : 0)  directly to a, and yields
 *     # an incorrect value
 *     if runtime._is_hip_environment:             # <<<<<<<<<<<<<<
 *         preamble += """
 *         __device__ int _hip_bool_cast(long long int x) {
*/
  }

  /* "cupy/_core/_kernel.pyx":1098
 *     # so after_loop must be included here even though it is taking
 *     # the default value. See https://github.com/cython/cython/issues/1630.
 *     return _get_simple_elementwise_kernel(             # <<<<<<<<<<<<<<
 *         params, arginfos, operation, name, type_map, preamble,
 *         loop_prep=loop_prep, after_loop='', options=("--std=c++17",))
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);

  /* "cupy/_core/_kernel.pyx":1099
 *     # the default value. See https://github.com/cython/cython/issues/1630.
 *     return _get_simple_elementwise_kernel(
 *         params, arginfos, operation, name, type_map, preamble,             # <<<<<<<<<<<<<<
 *         loop_prep=loop_prep, after_loop='', options=("--std=c++17",))
 * 
*/
  __pyx_t_2 = __pyx_v_params;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 1099, __pyx_L1_error)
  __pyx_t_11 = __pyx_v_name;
  __Pyx_INCREF(__pyx_t_11);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_11))) __PYX_ERR(0, 1099, __pyx_L1_error)
  __pyx_t_5 = __pyx_v_preamble;
  __Pyx_INCREF(__pyx_t_5);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_5))) __PYX_ERR(0, 1099, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1100
 *     return _get_simple_elementwise_kernel(
 *         params, arginfos, operation, name, type_map, preamble,
 *         loop_prep=loop_prep, after_loop='', options=("--std=c++17",))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_8 = __pyx_v_loop_prep;
  __Pyx_INCREF(__pyx_t_8);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(0, 1100, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1098
 *     # so after_loop must be included here even though it is taking
 *     # the default value. See https://github.com/cython/cython/issues/1630.
 *     return _get_simple_elementwise_kernel(             # <<<<<<<<<<<<<<
 *         params, arginfos, operation, name, type_map, preamble,
 *         loop_prep=loop_prep, after_loop='', options=("--std=c++17",))
*/
  __pyx_t_14.__pyx_n = 3;
  __pyx_t_14.loop_prep = ((PyObject*)__pyx_t_8);
  __pyx_t_14.after_loop = __pyx_mstate_global->__pyx_kp_u__3;
  __pyx_t_14.options = __pyx_mstate_global->__pyx_tuple[1];
  __pyx_t_7 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel__get_simple_elementwise_kernel(((PyObject*)__pyx_t_2), __pyx_v_arginfos, __pyx_v_operation, ((PyObject*)__pyx_t_11), __pyx_v_type_map, ((PyObject*)__pyx_t_5), &__pyx_t_14)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_r = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1024
 * 
 * 
 * cdef function.Function _get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *         tuple in_types, tuple out_types, routine, tuple arginfos,
 *         bint has_where, params,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cupy._core._kernel._get_ufunc_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arginfo);
  __Pyx_XDECREF(__pyx_v_str_type);
  __Pyx_XDECREF(__pyx_v_str_var);
  __Pyx_XDECREF(__pyx_v_offset_out);
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_out_op);
  __Pyx_XDECREF((PyObject *)__pyx_v_type_map);
  __Pyx_XDECREF(__pyx_v_operation);
  __Pyx_XDECREF(__pyx_v_preamble);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1103
 * 
 * 
 * cdef inline int _get_kind_score(kind) except -1:             # <<<<<<<<<<<<<<
 *     if issubclass(kind, numpy.bool_):
 *         return 0
*/

static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__get_kind_score(PyObject *__pyx_v_kind) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_kind_score", 0);

  /* "cupy/_core/_kernel.pyx":1104
 * 
 * cdef inline int _get_kind_score(kind) except -1:
 *     if issubclass(kind, numpy.bool_):             # <<<<<<<<<<<<<<
 *         return 0
 *     if issubclass(kind, (numpy.integer, int)):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_bool); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsSubclass(__pyx_v_kind, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1105
 * cdef inline int _get_kind_score(kind) except -1:
 *     if issubclass(kind, numpy.bool_):
 *         return 0             # <<<<<<<<<<<<<<
 *     if issubclass(kind, (numpy.integer, int)):
 *         return 1
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1104
 * 
 * cdef inline int _get_kind_score(kind) except -1:
 *     if issubclass(kind, numpy.bool_):             # <<<<<<<<<<<<<<
 *         return 0
 *     if issubclass(kind, (numpy.integer, int)):
*/
  }

  /* "cupy/_core/_kernel.pyx":1106
 *     if issubclass(kind, numpy.bool_):
 *         return 0
 *     if issubclass(kind, (numpy.integer, int)):             # <<<<<<<<<<<<<<
 *         return 1
 *     if issubclass(kind, (numpy.inexact, float, complex)):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1106, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)(&PyLong_Type));
  __Pyx_GIVEREF((PyObject *)(&PyLong_Type));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)(&PyLong_Type))) != (0)) __PYX_ERR(0, 1106, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsSubclass(__pyx_v_kind, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1107
 *         return 0
 *     if issubclass(kind, (numpy.integer, int)):
 *         return 1             # <<<<<<<<<<<<<<
 *     if issubclass(kind, (numpy.inexact, float, complex)):
 *         return 2
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1106
 *     if issubclass(kind, numpy.bool_):
 *         return 0
 *     if issubclass(kind, (numpy.integer, int)):             # <<<<<<<<<<<<<<
 *         return 1
 *     if issubclass(kind, (numpy.inexact, float, complex)):
*/
  }

  /* "cupy/_core/_kernel.pyx":1108
 *     if issubclass(kind, (numpy.integer, int)):
 *         return 1
 *     if issubclass(kind, (numpy.inexact, float, complex)):             # <<<<<<<<<<<<<<
 *         return 2
 *     # unknown type, assume higher score
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_inexact); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1108, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)(&PyFloat_Type));
  __Pyx_GIVEREF((PyObject *)(&PyFloat_Type));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)(&PyFloat_Type))) != (0)) __PYX_ERR(0, 1108, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)(&PyComplex_Type));
  __Pyx_GIVEREF((PyObject *)(&PyComplex_Type));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)(&PyComplex_Type))) != (0)) __PYX_ERR(0, 1108, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsSubclass(__pyx_v_kind, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1109
 *         return 1
 *     if issubclass(kind, (numpy.inexact, float, complex)):
 *         return 2             # <<<<<<<<<<<<<<
 *     # unknown type, assume higher score
 *     return 3
*/
    __pyx_r = 2;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1108
 *     if issubclass(kind, (numpy.integer, int)):
 *         return 1
 *     if issubclass(kind, (numpy.inexact, float, complex)):             # <<<<<<<<<<<<<<
 *         return 2
 *     # unknown type, assume higher score
*/
  }

  /* "cupy/_core/_kernel.pyx":1111
 *         return 2
 *     # unknown type, assume higher score
 *     return 3             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 3;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1103
 * 
 * 
 * cdef inline int _get_kind_score(kind) except -1:             # <<<<<<<<<<<<<<
 *     if issubclass(kind, numpy.bool_):
 *         return 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._get_kind_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1114
 * 
 * 
 * cdef inline bint _check_should_use_weak_scalar(             # <<<<<<<<<<<<<<
 *     tuple in_types, tuple weaks
 * ) except? -1:
*/

static CYTHON_INLINE int __pyx_f_4cupy_5_core_7_kernel__check_should_use_weak_scalar(PyObject *__pyx_v_in_types, PyObject *__pyx_v_weaks) {
  int __pyx_v_kind;
  int __pyx_v_max_array_kind;
  int __pyx_v_max_scalar_kind;
  int __pyx_v_all_scalars_or_arrays;
  PyObject *__pyx_v_in_t = NULL;
  PyObject *__pyx_v_w_t = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_should_use_weak_scalar", 0);

  /* "cupy/_core/_kernel.pyx":1128
 *     cdef bint all_scalars_or_arrays
 * 
 *     if weaks is None:             # <<<<<<<<<<<<<<
 *         # equivalent to (False,)*len(in_types)
 *         return False
*/
  __pyx_t_1 = (__pyx_v_weaks == ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1130
 *     if weaks is None:
 *         # equivalent to (False,)*len(in_types)
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     max_array_kind = -1
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1128
 *     cdef bint all_scalars_or_arrays
 * 
 *     if weaks is None:             # <<<<<<<<<<<<<<
 *         # equivalent to (False,)*len(in_types)
 *         return False
*/
  }

  /* "cupy/_core/_kernel.pyx":1132
 *         return False
 * 
 *     max_array_kind = -1             # <<<<<<<<<<<<<<
 *     max_scalar_kind = -1
 *     for in_t, w_t in zip(in_types, weaks):
*/
  __pyx_v_max_array_kind = -1;

  /* "cupy/_core/_kernel.pyx":1133
 * 
 *     max_array_kind = -1
 *     max_scalar_kind = -1             # <<<<<<<<<<<<<<
 *     for in_t, w_t in zip(in_types, weaks):
 *         if w_t:
*/
  __pyx_v_max_scalar_kind = -1;

  /* "cupy/_core/_kernel.pyx":1134
 *     max_array_kind = -1
 *     max_scalar_kind = -1
 *     for in_t, w_t in zip(in_types, weaks):             # <<<<<<<<<<<<<<
 *         if w_t:
 *             kind = _get_kind_score(w_t)
*/
  __pyx_t_3 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_in_types, __pyx_v_weaks};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1134, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1134, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_5;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1134, __pyx_L1_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5);
        #endif
        ++__pyx_t_5;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1134, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1134, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_8);
      } else {
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_8);
      }
      #else
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
      index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 1134, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1134, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_in_t, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_w_t, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "cupy/_core/_kernel.pyx":1135
 *     max_scalar_kind = -1
 *     for in_t, w_t in zip(in_types, weaks):
 *         if w_t:             # <<<<<<<<<<<<<<
 *             kind = _get_kind_score(w_t)
 *             max_scalar_kind = max(max_scalar_kind, kind)
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_w_t); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1135, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "cupy/_core/_kernel.pyx":1136
 *     for in_t, w_t in zip(in_types, weaks):
 *         if w_t:
 *             kind = _get_kind_score(w_t)             # <<<<<<<<<<<<<<
 *             max_scalar_kind = max(max_scalar_kind, kind)
 *         else:
*/
      __pyx_t_11 = __pyx_f_4cupy_5_core_7_kernel__get_kind_score(__pyx_v_w_t); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1136, __pyx_L1_error)
      __pyx_v_kind = __pyx_t_11;

      /* "cupy/_core/_kernel.pyx":1137
 *         if w_t:
 *             kind = _get_kind_score(w_t)
 *             max_scalar_kind = max(max_scalar_kind, kind)             # <<<<<<<<<<<<<<
 *         else:
 *             kind = _get_kind_score(in_t.type)  # kind score uses scalar type
*/
      __pyx_t_11 = __pyx_v_kind;
      __pyx_t_12 = __pyx_v_max_scalar_kind;
      __pyx_t_1 = (__pyx_t_11 > __pyx_t_12);
      if (__pyx_t_1) {
        __pyx_t_13 = __pyx_t_11;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      __pyx_v_max_scalar_kind = __pyx_t_13;

      /* "cupy/_core/_kernel.pyx":1135
 *     max_scalar_kind = -1
 *     for in_t, w_t in zip(in_types, weaks):
 *         if w_t:             # <<<<<<<<<<<<<<
 *             kind = _get_kind_score(w_t)
 *             max_scalar_kind = max(max_scalar_kind, kind)
*/
      goto __pyx_L8;
    }

    /* "cupy/_core/_kernel.pyx":1139
 *             max_scalar_kind = max(max_scalar_kind, kind)
 *         else:
 *             kind = _get_kind_score(in_t.type)  # kind score uses scalar type             # <<<<<<<<<<<<<<
 *             max_array_kind = max(max_array_kind, kind)
 * 
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_in_t, __pyx_mstate_global->__pyx_n_u_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = __pyx_f_4cupy_5_core_7_kernel__get_kind_score(__pyx_t_2); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_kind = __pyx_t_13;

      /* "cupy/_core/_kernel.pyx":1140
 *         else:
 *             kind = _get_kind_score(in_t.type)  # kind score uses scalar type
 *             max_array_kind = max(max_array_kind, kind)             # <<<<<<<<<<<<<<
 * 
 *     all_scalars_or_arrays = max_scalar_kind == -1 or max_array_kind == -1
*/
      __pyx_t_13 = __pyx_v_kind;
      __pyx_t_11 = __pyx_v_max_array_kind;
      __pyx_t_1 = (__pyx_t_13 > __pyx_t_11);
      if (__pyx_t_1) {
        __pyx_t_12 = __pyx_t_13;
      } else {
        __pyx_t_12 = __pyx_t_11;
      }
      __pyx_v_max_array_kind = __pyx_t_12;
    }
    __pyx_L8:;

    /* "cupy/_core/_kernel.pyx":1134
 *     max_array_kind = -1
 *     max_scalar_kind = -1
 *     for in_t, w_t in zip(in_types, weaks):             # <<<<<<<<<<<<<<
 *         if w_t:
 *             kind = _get_kind_score(w_t)
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1142
 *             max_array_kind = max(max_array_kind, kind)
 * 
 *     all_scalars_or_arrays = max_scalar_kind == -1 or max_array_kind == -1             # <<<<<<<<<<<<<<
 * 
 *     return not all_scalars_or_arrays and max_array_kind >= max_scalar_kind
*/
  __pyx_t_14 = (__pyx_v_max_scalar_kind == -1L);
  if (!__pyx_t_14) {
  } else {
    __pyx_t_1 = __pyx_t_14;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_14 = (__pyx_v_max_array_kind == -1L);
  __pyx_t_1 = __pyx_t_14;
  __pyx_L10_bool_binop_done:;
  __pyx_v_all_scalars_or_arrays = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":1144
 *     all_scalars_or_arrays = max_scalar_kind == -1 or max_array_kind == -1
 * 
 *     return not all_scalars_or_arrays and max_array_kind >= max_scalar_kind             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_14 = (!__pyx_v_all_scalars_or_arrays);
  if (__pyx_t_14) {
  } else {
    __pyx_t_1 = __pyx_t_14;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_14 = (__pyx_v_max_array_kind >= __pyx_v_max_scalar_kind);
  __pyx_t_1 = __pyx_t_14;
  __pyx_L12_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1114
 * 
 * 
 * cdef inline bint _check_should_use_weak_scalar(             # <<<<<<<<<<<<<<
 *     tuple in_types, tuple weaks
 * ) except? -1:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cupy._core._kernel._check_should_use_weak_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_in_t);
  __Pyx_XDECREF(__pyx_v_w_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1182
 *         readonly object __name__
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_nin = 0;
  PyObject *__pyx_v_nout = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_ops = 0;
  PyObject *__pyx_v_preamble = 0;
  PyObject *__pyx_v_loop_prep = 0;
  PyObject *__pyx_v_doc = 0;
  PyObject *__pyx_v_default_casting = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops = 0;
  PyObject *__pyx_v_cutensor_op = 0;
  PyObject *__pyx_v_scatter_op = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_nin,&__pyx_mstate_global->__pyx_n_u_nout,&__pyx_mstate_global->__pyx_n_u_ops,&__pyx_mstate_global->__pyx_n_u_preamble,&__pyx_mstate_global->__pyx_n_u_loop_prep,&__pyx_mstate_global->__pyx_n_u_doc,&__pyx_mstate_global->__pyx_n_u_default_casting,&__pyx_mstate_global->__pyx_n_u_out_ops,&__pyx_mstate_global->__pyx_n_u_cutensor_op,&__pyx_mstate_global->__pyx_n_u_scatter_op,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1182, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1182, __pyx_L3_error)
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":1184
 *     def __init__(
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,             # <<<<<<<<<<<<<<
 *             scatter_op=None):
 *         self.name = name
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1185
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
 *             scatter_op=None):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.__name__ = name
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 8, i); __PYX_ERR(0, 1182, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1182, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1182, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1182, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1182, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1182, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":1184
 *     def __init__(
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,             # <<<<<<<<<<<<<<
 *             scatter_op=None):
 *         self.name = name
*/
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1185
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
 *             scatter_op=None):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.__name__ = name
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_name = values[0];
    __pyx_v_nin = values[1];
    __pyx_v_nout = values[2];
    __pyx_v_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)values[3]);
    __pyx_v_preamble = values[4];
    __pyx_v_loop_prep = values[5];
    __pyx_v_doc = values[6];
    __pyx_v_default_casting = values[7];
    __pyx_v_out_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)values[8]);
    __pyx_v_cutensor_op = values[9];
    __pyx_v_scatter_op = values[10];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 8, __pyx_nargs); __PYX_ERR(0, 1182, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ops), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops, 1, "ops", 0))) __PYX_ERR(0, 1183, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_ops), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops, 1, "out_ops", 0))) __PYX_ERR(0, 1184, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc___init__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_name, __pyx_v_nin, __pyx_v_nout, __pyx_v_ops, __pyx_v_preamble, __pyx_v_loop_prep, __pyx_v_doc, __pyx_v_default_casting, __pyx_v_out_ops, __pyx_v_cutensor_op, __pyx_v_scatter_op);

  /* "cupy/_core/_kernel.pyx":1182
 *         readonly object __name__
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cupy/_core/_kernel.pyx":1209
 * 
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)             # <<<<<<<<<<<<<<
 *             for i in range(nin))
 *         _out_params = tuple(
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr(__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1209, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_init___locals_genexpr, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!gen)) __PYX_ERR(0, 1209, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1209, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":1210
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)
 *             for i in range(nin))             # <<<<<<<<<<<<<<
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
*/
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1210, __pyx_L1_error) }
  __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __pyx_L1_error)
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1210, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1209
 * 
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)             # <<<<<<<<<<<<<<
 *             for i in range(nin))
 *         _out_params = tuple(
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_T_in_d, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, Py_True};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1209, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1209, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":1210
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)
 *             for i in range(nin))             # <<<<<<<<<<<<<<
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "cupy/_core/_kernel.pyx":1209
 * 
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)             # <<<<<<<<<<<<<<
 *             for i in range(nin))
 *         _out_params = tuple(
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cupy/_core/_kernel.pyx":1212
 *             for i in range(nin))
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)             # <<<<<<<<<<<<<<
 *             for i in range(nout))
 *         _other_params = (
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1212, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_init___locals_genexpr, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!gen)) __PYX_ERR(0, 1212, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1212, __pyx_L1_error)
  }

  /* "cupy/_core/_kernel.pyx":1213
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
 *             for i in range(nout))             # <<<<<<<<<<<<<<
 *         _other_params = (
 *             ParameterInfo('CIndexer _ind', False),)
*/
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1213, __pyx_L1_error) }
  __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1213, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1212
 *             for i in range(nin))
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)             # <<<<<<<<<<<<<<
 *             for i in range(nout))
 *         _other_params = (
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_T_out_d, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_5, Py_False};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
      __Pyx_GOTREF((PyObject *)__pyx_t_3);
    }
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1212, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":1213
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
 *             for i in range(nout))             # <<<<<<<<<<<<<<
 *         _other_params = (
 *             ParameterInfo('CIndexer _ind', False),)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "cupy/_core/_kernel.pyx":1212
 *             for i in range(nin))
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)             # <<<<<<<<<<<<<<
 *             for i in range(nout))
 *         _other_params = (
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1182
 *         readonly object __name__
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
*/

static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc___init__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_nin, PyObject *__pyx_v_nout, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_ops, PyObject *__pyx_v_preamble, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_doc, PyObject *__pyx_v_default_casting, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops, PyObject *__pyx_v_cutensor_op, PyObject *__pyx_v_scatter_op) {
  PyObject *__pyx_v__in_params = NULL;
  PyObject *__pyx_v__out_params = NULL;
  PyObject *__pyx_v__other_params = NULL;
  PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___2generator = 0;
  PyObject *__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___5generator1 = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":1186
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
 *             scatter_op=None):
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.__name__ = name
 *         self.nin = nin
*/
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "cupy/_core/_kernel.pyx":1187
 *             scatter_op=None):
 *         self.name = name
 *         self.__name__ = name             # <<<<<<<<<<<<<<
 *         self.nin = nin
 *         self.nout = nout
*/
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->__pyx___name__);
  __Pyx_DECREF(__pyx_v_self->__pyx___name__);
  __pyx_v_self->__pyx___name__ = __pyx_v_name;

  /* "cupy/_core/_kernel.pyx":1188
 *         self.name = name
 *         self.__name__ = name
 *         self.nin = nin             # <<<<<<<<<<<<<<
 *         self.nout = nout
 *         self.nargs = nin + nout
*/
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nin); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1188, __pyx_L1_error)
  __pyx_v_self->nin = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":1189
 *         self.__name__ = name
 *         self.nin = nin
 *         self.nout = nout             # <<<<<<<<<<<<<<
 *         self.nargs = nin + nout
 *         self._ops = ops
*/
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nout); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1189, __pyx_L1_error)
  __pyx_v_self->nout = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":1190
 *         self.nin = nin
 *         self.nout = nout
 *         self.nargs = nin + nout             # <<<<<<<<<<<<<<
 *         self._ops = ops
 *         self._out_ops = out_ops
*/
  __pyx_t_2 = PyNumber_Add(__pyx_v_nin, __pyx_v_nout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->nargs = __pyx_t_1;

  /* "cupy/_core/_kernel.pyx":1191
 *         self.nout = nout
 *         self.nargs = nin + nout
 *         self._ops = ops             # <<<<<<<<<<<<<<
 *         self._out_ops = out_ops
 *         self._preamble = preamble
*/
  __Pyx_INCREF((PyObject *)__pyx_v_ops);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ops);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_ops);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_ops);
  __pyx_v_self->_ops = __pyx_v_ops;

  /* "cupy/_core/_kernel.pyx":1192
 *         self.nargs = nin + nout
 *         self._ops = ops
 *         self._out_ops = out_ops             # <<<<<<<<<<<<<<
 *         self._preamble = preamble
 *         self._loop_prep = loop_prep
*/
  __Pyx_INCREF((PyObject *)__pyx_v_out_ops);
  __Pyx_GIVEREF((PyObject *)__pyx_v_out_ops);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->_out_ops);
  __Pyx_DECREF((PyObject *)__pyx_v_self->_out_ops);
  __pyx_v_self->_out_ops = __pyx_v_out_ops;

  /* "cupy/_core/_kernel.pyx":1193
 *         self._ops = ops
 *         self._out_ops = out_ops
 *         self._preamble = preamble             # <<<<<<<<<<<<<<
 *         self._loop_prep = loop_prep
 *         self._doc = doc
*/
  __Pyx_INCREF(__pyx_v_preamble);
  __Pyx_GIVEREF(__pyx_v_preamble);
  __Pyx_GOTREF(__pyx_v_self->_preamble);
  __Pyx_DECREF(__pyx_v_self->_preamble);
  __pyx_v_self->_preamble = __pyx_v_preamble;

  /* "cupy/_core/_kernel.pyx":1194
 *         self._out_ops = out_ops
 *         self._preamble = preamble
 *         self._loop_prep = loop_prep             # <<<<<<<<<<<<<<
 *         self._doc = doc
 *         self.__doc__ = doc
*/
  __Pyx_INCREF(__pyx_v_loop_prep);
  __Pyx_GIVEREF(__pyx_v_loop_prep);
  __Pyx_GOTREF(__pyx_v_self->_loop_prep);
  __Pyx_DECREF(__pyx_v_self->_loop_prep);
  __pyx_v_self->_loop_prep = __pyx_v_loop_prep;

  /* "cupy/_core/_kernel.pyx":1195
 *         self._preamble = preamble
 *         self._loop_prep = loop_prep
 *         self._doc = doc             # <<<<<<<<<<<<<<
 *         self.__doc__ = doc
 *         if default_casting is None:
*/
  __Pyx_INCREF(__pyx_v_doc);
  __Pyx_GIVEREF(__pyx_v_doc);
  __Pyx_GOTREF(__pyx_v_self->_doc);
  __Pyx_DECREF(__pyx_v_self->_doc);
  __pyx_v_self->_doc = __pyx_v_doc;

  /* "cupy/_core/_kernel.pyx":1196
 *         self._loop_prep = loop_prep
 *         self._doc = doc
 *         self.__doc__ = doc             # <<<<<<<<<<<<<<
 *         if default_casting is None:
 *             self._default_casting = 'same_kind'
*/
  __Pyx_INCREF(__pyx_v_doc);
  __Pyx_GIVEREF(__pyx_v_doc);
  __Pyx_GOTREF(__pyx_v_self->__pyx___doc__);
  __Pyx_DECREF(__pyx_v_self->__pyx___doc__);
  __pyx_v_self->__pyx___doc__ = __pyx_v_doc;

  /* "cupy/_core/_kernel.pyx":1197
 *         self._doc = doc
 *         self.__doc__ = doc
 *         if default_casting is None:             # <<<<<<<<<<<<<<
 *             self._default_casting = 'same_kind'
 *         else:
*/
  __pyx_t_3 = (__pyx_v_default_casting == Py_None);
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1198
 *         self.__doc__ = doc
 *         if default_casting is None:
 *             self._default_casting = 'same_kind'             # <<<<<<<<<<<<<<
 *         else:
 *             self._default_casting = default_casting
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_same_kind);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_same_kind);
    __Pyx_GOTREF(__pyx_v_self->_default_casting);
    __Pyx_DECREF(__pyx_v_self->_default_casting);
    __pyx_v_self->_default_casting = __pyx_mstate_global->__pyx_n_u_same_kind;

    /* "cupy/_core/_kernel.pyx":1197
 *         self._doc = doc
 *         self.__doc__ = doc
 *         if default_casting is None:             # <<<<<<<<<<<<<<
 *             self._default_casting = 'same_kind'
 *         else:
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1200
 *             self._default_casting = 'same_kind'
 *         else:
 *             self._default_casting = default_casting             # <<<<<<<<<<<<<<
 * 
 *         if cutensor_op is not None and cuda_cutensor is not None:
*/
  /*else*/ {
    __Pyx_INCREF(__pyx_v_default_casting);
    __Pyx_GIVEREF(__pyx_v_default_casting);
    __Pyx_GOTREF(__pyx_v_self->_default_casting);
    __Pyx_DECREF(__pyx_v_self->_default_casting);
    __pyx_v_self->_default_casting = __pyx_v_default_casting;
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1202
 *             self._default_casting = default_casting
 * 
 *         if cutensor_op is not None and cuda_cutensor is not None:             # <<<<<<<<<<<<<<
 *             self._cutensor_op, self._cutensor_alpha, self._cutensor_gamma = (
 *                 getattr(cuda_cutensor, cutensor_op[0]),
*/
  __pyx_t_4 = (__pyx_v_cutensor_op != Py_None);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cuda_cutensor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "cupy/_core/_kernel.pyx":1204
 *         if cutensor_op is not None and cuda_cutensor is not None:
 *             self._cutensor_op, self._cutensor_alpha, self._cutensor_gamma = (
 *                 getattr(cuda_cutensor, cutensor_op[0]),             # <<<<<<<<<<<<<<
 *                 cutensor_op[1], cutensor_op[2])
 *         self._scatter_op = scatter_op
*/
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cuda_cutensor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_cutensor_op, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_GetAttr(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1205
 *             self._cutensor_op, self._cutensor_alpha, self._cutensor_gamma = (
 *                 getattr(cuda_cutensor, cutensor_op[0]),
 *                 cutensor_op[1], cutensor_op[2])             # <<<<<<<<<<<<<<
 *         self._scatter_op = scatter_op
 * 
*/
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_cutensor_op, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_cutensor_op, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1203
 * 
 *         if cutensor_op is not None and cuda_cutensor is not None:
 *             self._cutensor_op, self._cutensor_alpha, self._cutensor_gamma = (             # <<<<<<<<<<<<<<
 *                 getattr(cuda_cutensor, cutensor_op[0]),
 *                 cutensor_op[1], cutensor_op[2])
*/
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->_cutensor_op);
    __Pyx_DECREF(__pyx_v_self->_cutensor_op);
    __pyx_v_self->_cutensor_op = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_self->_cutensor_alpha = __pyx_t_7;
    __pyx_v_self->_cutensor_gamma = __pyx_t_8;

    /* "cupy/_core/_kernel.pyx":1202
 *             self._default_casting = default_casting
 * 
 *         if cutensor_op is not None and cuda_cutensor is not None:             # <<<<<<<<<<<<<<
 *             self._cutensor_op, self._cutensor_alpha, self._cutensor_gamma = (
 *                 getattr(cuda_cutensor, cutensor_op[0]),
*/
  }

  /* "cupy/_core/_kernel.pyx":1206
 *                 getattr(cuda_cutensor, cutensor_op[0]),
 *                 cutensor_op[1], cutensor_op[2])
 *         self._scatter_op = scatter_op             # <<<<<<<<<<<<<<
 * 
 *         _in_params = tuple(
*/
  __pyx_t_6 = __pyx_v_scatter_op;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_6))) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_scatter_op);
  __Pyx_DECREF(__pyx_v_self->_scatter_op);
  __pyx_v_self->_scatter_op = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1210
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)
 *             for i in range(nin))             # <<<<<<<<<<<<<<
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
*/
  __pyx_t_5 = NULL;
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_nin};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }

  /* "cupy/_core/_kernel.pyx":1209
 * 
 *         _in_params = tuple(
 *             ParameterInfo('T in%d' % i, True)             # <<<<<<<<<<<<<<
 *             for i in range(nin))
 *         _out_params = tuple(
*/
  __pyx_t_5 = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___genexpr(NULL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1208
 *         self._scatter_op = scatter_op
 * 
 *         _in_params = tuple(             # <<<<<<<<<<<<<<
 *             ParameterInfo('T in%d' % i, True)
 *             for i in range(nin))
*/
  __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v__in_params = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1213
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)
 *             for i in range(nout))             # <<<<<<<<<<<<<<
 *         _other_params = (
 *             ParameterInfo('CIndexer _ind', False),)
*/
  __pyx_t_5 = NULL;
  __pyx_t_9 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_nout};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }

  /* "cupy/_core/_kernel.pyx":1212
 *             for i in range(nin))
 *         _out_params = tuple(
 *             ParameterInfo('T out%d' % i, False)             # <<<<<<<<<<<<<<
 *             for i in range(nout))
 *         _other_params = (
*/
  __pyx_t_5 = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__init___3genexpr(NULL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1211
 *             ParameterInfo('T in%d' % i, True)
 *             for i in range(nin))
 *         _out_params = tuple(             # <<<<<<<<<<<<<<
 *             ParameterInfo('T out%d' % i, False)
 *             for i in range(nout))
*/
  __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v__out_params = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1215
 *             for i in range(nout))
 *         _other_params = (
 *             ParameterInfo('CIndexer _ind', False),)             # <<<<<<<<<<<<<<
 *         self._params = _in_params + _out_params + _other_params
 *         self._params_with_where = (
*/
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo), __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1215, __pyx_L1_error);
  __pyx_t_6 = 0;
  __pyx_v__other_params = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1216
 *         _other_params = (
 *             ParameterInfo('CIndexer _ind', False),)
 *         self._params = _in_params + _out_params + _other_params             # <<<<<<<<<<<<<<
 *         self._params_with_where = (
 *             _in_params + (ParameterInfo('T _where', False),)
*/
  __pyx_t_5 = PyNumber_Add(__pyx_v__in_params, __pyx_v__out_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v__other_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_params);
  __Pyx_DECREF(__pyx_v_self->_params);
  __pyx_v_self->_params = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1218
 *         self._params = _in_params + _out_params + _other_params
 *         self._params_with_where = (
 *             _in_params + (ParameterInfo('T _where', False),)             # <<<<<<<<<<<<<<
 *             + _out_params + _other_params)
 *         self._routine_cache = {}
*/
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo), __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1218, __pyx_L1_error);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_v__in_params, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1219
 *         self._params_with_where = (
 *             _in_params + (ParameterInfo('T _where', False),)
 *             + _out_params + _other_params)             # <<<<<<<<<<<<<<
 *         self._routine_cache = {}
 *         self._kernel_memo = {}
*/
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v__out_params); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v__other_params); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1217
 *             ParameterInfo('CIndexer _ind', False),)
 *         self._params = _in_params + _out_params + _other_params
 *         self._params_with_where = (             # <<<<<<<<<<<<<<
 *             _in_params + (ParameterInfo('T _where', False),)
 *             + _out_params + _other_params)
*/
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_params_with_where);
  __Pyx_DECREF(__pyx_v_self->_params_with_where);
  __pyx_v_self->_params_with_where = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1220
 *             _in_params + (ParameterInfo('T _where', False),)
 *             + _out_params + _other_params)
 *         self._routine_cache = {}             # <<<<<<<<<<<<<<
 *         self._kernel_memo = {}
 * 
*/
  __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_routine_cache);
  __Pyx_DECREF(__pyx_v_self->_routine_cache);
  __pyx_v_self->_routine_cache = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1221
 *             + _out_params + _other_params)
 *         self._routine_cache = {}
 *         self._kernel_memo = {}             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->_kernel_memo);
  __Pyx_DECREF(__pyx_v_self->_kernel_memo);
  __pyx_v_self->_kernel_memo = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1182
 *         readonly object __name__
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='',
 *             default_casting=None, *, _Ops out_ops=None, cutensor_op=None,
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__in_params);
  __Pyx_XDECREF(__pyx_v__out_params);
  __Pyx_XDECREF(__pyx_v__other_params);
  __Pyx_XDECREF(__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___2generator);
  __Pyx_XDECREF(__pyx_gb_4cupy_5_core_7_kernel_5ufunc_8__init___5generator1);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1223
 *         self._kernel_memo = {}
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ufunc \'%s\'>' % self.name
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_3__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_2__repr__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_2__repr__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cupy/_core/_kernel.pyx":1224
 * 
 *     def __repr__(self):
 *         return '<ufunc \'%s\'>' % self.name             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_ufunc_s, __pyx_v_self->name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1223
 *         self._kernel_memo = {}
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<ufunc \'%s\'>' % self.name
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1226
 *         return '<ufunc \'%s\'>' % self.name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def types(self):
 *         """A list of type signatures.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5types_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_5types___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_5types___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_v_op = NULL;
  PyObject *__pyx_v_in_str = NULL;
  PyObject *__pyx_v_out_str = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_t = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[3];
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "cupy/_core/_kernel.pyx":1234
 * 
 *         """
 *         types = []             # <<<<<<<<<<<<<<
 *         for op in self._ops.ops:
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1235
 *         """
 *         types = []
 *         for op in self._ops.ops:             # <<<<<<<<<<<<<<
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])
*/
  if (unlikely(__pyx_v_self->_ops->ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1235, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->_ops->ops; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1235, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_op, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1236
 *         types = []
 *         for op in self._ops.ops:
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])             # <<<<<<<<<<<<<<
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])
 *             types.append('%s->%s' % (in_str, out_str))
*/
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_op, __pyx_mstate_global->__pyx_n_u_in_types); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L7_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1236, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1236, __pyx_L7_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1236, __pyx_L7_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1236, __pyx_L7_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L7_error)
        } else {
          __pyx_t_4 = __pyx_t_7(__pyx_t_5);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1236, __pyx_L7_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_t, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr11__pyx_v_t, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_char); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1236, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)((PyObject*)__pyx_t_8)))) __PYX_ERR(0, 1236, __pyx_L7_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_t); __pyx_9genexpr11__pyx_v_t = 0;
      goto __pyx_L11_exit_scope;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_t); __pyx_9genexpr11__pyx_v_t = 0;
      goto __pyx_L1_error;
      __pyx_L11_exit_scope:;
    } /* exit inner scope */
    __pyx_t_5 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__3, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_in_str, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1237
 *         for op in self._ops.ops:
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])             # <<<<<<<<<<<<<<
 *             types.append('%s->%s' % (in_str, out_str))
 *         return types
*/
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1237, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_op, __pyx_mstate_global->__pyx_n_u_out_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
        __pyx_t_8 = __pyx_t_3; __Pyx_INCREF(__pyx_t_8);
        __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1237, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1237, __pyx_L14_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1237, __pyx_L14_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
            ++__pyx_t_6;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1237, __pyx_L14_error)
              #endif
              if (__pyx_t_6 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6));
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_6);
            #endif
            ++__pyx_t_6;
          }
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L14_error)
        } else {
          __pyx_t_3 = __pyx_t_7(__pyx_t_8);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1237, __pyx_L14_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_t, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr12__pyx_v_t, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_char); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)((PyObject*)__pyx_t_4)))) __PYX_ERR(0, 1237, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_t); __pyx_9genexpr12__pyx_v_t = 0;
      goto __pyx_L18_exit_scope;
      __pyx_L14_error:;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_t); __pyx_9genexpr12__pyx_v_t = 0;
      goto __pyx_L1_error;
      __pyx_L18_exit_scope:;
    } /* exit inner scope */
    __pyx_t_8 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__3, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_out_str, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "cupy/_core/_kernel.pyx":1238
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])
 *             types.append('%s->%s' % (in_str, out_str))             # <<<<<<<<<<<<<<
 *         return types
 * 
*/
    __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_in_str); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_out_str); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9[0] = __pyx_t_8;
    __pyx_t_9[1] = __pyx_mstate_global->__pyx_kp_u__17;
    __pyx_t_9[2] = __pyx_t_5;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_types, __pyx_t_4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1238, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":1235
 *         """
 *         types = []
 *         for op in self._ops.ops:             # <<<<<<<<<<<<<<
 *             in_str = ''.join([<str>get_dtype(t).char for t in op.in_types])
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1239
 *             out_str = ''.join([<str>get_dtype(t).char for t in op.out_types])
 *             types.append('%s->%s' % (in_str, out_str))
 *         return types             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, *args, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_types);
  __pyx_r = __pyx_v_types;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1226
 *         return '<ufunc \'%s\'>' % self.name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def types(self):
 *         """A list of type signatures.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.types.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_in_str);
  __Pyx_XDECREF(__pyx_v_out_str);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_t);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1241
 *         return types
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Applies the universal function to arguments elementwise.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_4__call__, "ufunc.__call__(self, *args, **kwargs)\n\nApplies the universal function to arguments elementwise.\n\nArgs:\n    args: Input arguments. Each of them can be a :class:`cupy.ndarray`\n        object or a scalar. The output arguments can be omitted or be\n        specified by the ``out`` argument.\n    out (cupy.ndarray): Output array. It outputs to new arrays\n        default.\n    dtype: Data type specifier.\n\nReturns:\n    Output array or a tuple of output arrays.");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_4cupy_5_core_7_kernel_5ufunc_4__call__;
#endif
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("__call__", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_4__call__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1361
 *         # Determine a template object from which we initialize the output when
 *         # inputs have subclass instances
 *         def issubclass1(cls, classinfo):             # <<<<<<<<<<<<<<
 *             return issubclass(cls, classinfo) and cls is not classinfo
 *         subtype = cupy.ndarray
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__call___1issubclass1(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_5ufunc_8__call___1issubclass1 = {"issubclass1", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__call___1issubclass1, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__call___1issubclass1(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_classinfo = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issubclass1 (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cls,&__pyx_mstate_global->__pyx_n_u_classinfo,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1361, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1361, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "issubclass1", 0) < (0)) __PYX_ERR(0, 1361, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("issubclass1", 1, 2, 2, i); __PYX_ERR(0, 1361, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1361, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1361, __pyx_L3_error)
    }
    __pyx_v_cls = values[0];
    __pyx_v_classinfo = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("issubclass1", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1361, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__call__.issubclass1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__call___issubclass1(__pyx_self, __pyx_v_cls, __pyx_v_classinfo);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__call___issubclass1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_classinfo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("issubclass1", 0);

  /* "cupy/_core/_kernel.pyx":1362
 *         # inputs have subclass instances
 *         def issubclass1(cls, classinfo):
 *             return issubclass(cls, classinfo) and cls is not classinfo             # <<<<<<<<<<<<<<
 *         subtype = cupy.ndarray
 *         template = None
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_IsSubclass(__pyx_v_cls, __pyx_v_classinfo); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1362, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_cls != __pyx_v_classinfo);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1361
 *         # Determine a template object from which we initialize the output when
 *         # inputs have subclass instances
 *         def issubclass1(cls, classinfo):             # <<<<<<<<<<<<<<
 *             return issubclass(cls, classinfo) and cls is not classinfo
 *         subtype = cupy.ndarray
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__call__.issubclass1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1241
 *         return types
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Applies the universal function to arguments elementwise.
 * 
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4__call__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_arg = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_v_kern = 0;
  PyObject *__pyx_v_inout_args = 0;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_v_shape;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_where = NULL;
  int __pyx_v_has_where;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_casting = NULL;
  Py_ssize_t __pyx_v_n_args;
  PyObject *__pyx_v_in_args = NULL;
  PyObject *__pyx_v_out_args = NULL;
  int __pyx_v_dev_id;
  PyObject *__pyx_v_given_out_args = NULL;
  PyObject *__pyx_v_where_args = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_cupyx = NULL;
  PyObject *__pyx_v_ret = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_op = NULL;
  PyObject *__pyx_v_issubclass1 = 0;
  PyObject *__pyx_v_subtype = NULL;
  PyObject *__pyx_v_template = NULL;
  PyObject *__pyx_v_in_arg = NULL;
  PyTypeObject *__pyx_v_in_arg_type = NULL;
  PyObject *__pyx_v_core_in_dtypes = NULL;
  PyObject *__pyx_v_core_out_dtypes = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_t = NULL;
  struct __pyx_obj_4cupy_5_core_7_carray_Indexer *__pyx_v_indexer = NULL;
  PyObject *__pyx_v_arginfos = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_o = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14[5];
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __pyx_t_4cupy_5_core_7_carray_shape_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "cupy/_core/_kernel.pyx":1256
 * 
 *         """
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
*/
  __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1256, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1257
 *         """
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):             # <<<<<<<<<<<<<<
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)
*/
    __pyx_t_4 = __Pyx_HasAttr(__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_cupy_override_elementwise_kern); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1257, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "cupy/_core/_kernel.pyx":1258
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 * 
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_cupy_override_elementwise_kern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "cupy/_core/_kernel.pyx":1259
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if _fusion_thread_local.is_fusing():
*/
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_v_self);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 1258, __pyx_L1_error);

      /* "cupy/_core/_kernel.pyx":1258
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 * 
*/
      __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":1259
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if _fusion_thread_local.is_fusing():
*/
      __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "cupy/_core/_kernel.pyx":1258
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(             # <<<<<<<<<<<<<<
 *                     self, *args, **kwargs)
 * 
*/
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "cupy/_core/_kernel.pyx":1257
 *         """
 *         for arg in args:
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):             # <<<<<<<<<<<<<<
 *                 return arg.__cupy_override_elementwise_kernel__(
 *                     self, *args, **kwargs)
*/
    }

    /* "cupy/_core/_kernel.pyx":1256
 * 
 *         """
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if hasattr(arg, '__cupy_override_elementwise_kernel__'):
 *                 return arg.__cupy_override_elementwise_kernel__(
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1261
 *                     self, *args, **kwargs)
 * 
 *         if _fusion_thread_local.is_fusing():             # <<<<<<<<<<<<<<
 *             return _fusion_thread_local.call_ufunc(self, *args, **kwargs)
 * 
*/
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_fusion_thread_local); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_is_fusing); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "cupy/_core/_kernel.pyx":1262
 * 
 *         if _fusion_thread_local.is_fusing():
 *             return _fusion_thread_local.call_ufunc(self, *args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         cdef function.Function kern
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_fusion_thread_local); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_call_ufunc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __Pyx_GIVEREF((PyObject *)__pyx_v_self);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 1262, __pyx_L1_error);
    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1261
 *                     self, *args, **kwargs)
 * 
 *         if _fusion_thread_local.is_fusing():             # <<<<<<<<<<<<<<
 *             return _fusion_thread_local.call_ufunc(self, *args, **kwargs)
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1268
 *         cdef shape_t shape
 * 
 *         out = kwargs.pop('out', None)             # <<<<<<<<<<<<<<
 *         where = kwargs.pop('_where', None)
 *         cdef bint has_where = where is not None
*/
  __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_out, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1269
 * 
 *         out = kwargs.pop('out', None)
 *         where = kwargs.pop('_where', None)             # <<<<<<<<<<<<<<
 *         cdef bint has_where = where is not None
 *         dtype = kwargs.pop('dtype', None)
*/
  __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_where, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_where = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1270
 *         out = kwargs.pop('out', None)
 *         where = kwargs.pop('_where', None)
 *         cdef bint has_where = where is not None             # <<<<<<<<<<<<<<
 *         dtype = kwargs.pop('dtype', None)
 *         # Note default behavior of casting is 'same_kind' on numpy>=1.10
*/
  __pyx_t_4 = (__pyx_v_where != Py_None);
  __pyx_v_has_where = __pyx_t_4;

  /* "cupy/_core/_kernel.pyx":1271
 *         where = kwargs.pop('_where', None)
 *         cdef bint has_where = where is not None
 *         dtype = kwargs.pop('dtype', None)             # <<<<<<<<<<<<<<
 *         # Note default behavior of casting is 'same_kind' on numpy>=1.10
 *         casting = kwargs.pop('casting', self._default_casting)
*/
  __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_dtype, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_dtype = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1273
 *         dtype = kwargs.pop('dtype', None)
 *         # Note default behavior of casting is 'same_kind' on numpy>=1.10
 *         casting = kwargs.pop('casting', self._default_casting)             # <<<<<<<<<<<<<<
 *         if dtype is not None:
 *             dtype = get_dtype(dtype)
*/
  __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_casting, __pyx_v_self->_default_casting); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_casting = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1274
 *         # Note default behavior of casting is 'same_kind' on numpy>=1.10
 *         casting = kwargs.pop('casting', self._default_casting)
 *         if dtype is not None:             # <<<<<<<<<<<<<<
 *             dtype = get_dtype(dtype)
 *         if kwargs:
*/
  __pyx_t_4 = (__pyx_v_dtype != Py_None);
  if (__pyx_t_4) {

    /* "cupy/_core/_kernel.pyx":1275
 *         casting = kwargs.pop('casting', self._default_casting)
 *         if dtype is not None:
 *             dtype = get_dtype(dtype)             # <<<<<<<<<<<<<<
 *         if kwargs:
 *             raise TypeError('Wrong arguments %s' % kwargs)
*/
    __pyx_t_5 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_v_dtype, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1274
 *         # Note default behavior of casting is 'same_kind' on numpy>=1.10
 *         casting = kwargs.pop('casting', self._default_casting)
 *         if dtype is not None:             # <<<<<<<<<<<<<<
 *             dtype = get_dtype(dtype)
 *         if kwargs:
*/
  }

  /* "cupy/_core/_kernel.pyx":1276
 *         if dtype is not None:
 *             dtype = get_dtype(dtype)
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             raise TypeError('Wrong arguments %s' % kwargs)
 * 
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1276, __pyx_L1_error)
  if (unlikely(__pyx_t_4)) {

    /* "cupy/_core/_kernel.pyx":1277
 *             dtype = get_dtype(dtype)
 *         if kwargs:
 *             raise TypeError('Wrong arguments %s' % kwargs)             # <<<<<<<<<<<<<<
 * 
 *         n_args = len(args)
*/
    __pyx_t_1 = NULL;
    __pyx_t_7 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Wrong_arguments_s, __pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1277, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":1276
 *         if dtype is not None:
 *             dtype = get_dtype(dtype)
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             raise TypeError('Wrong arguments %s' % kwargs)
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1279
 *             raise TypeError('Wrong arguments %s' % kwargs)
 * 
 *         n_args = len(args)             # <<<<<<<<<<<<<<
 *         if not (self.nin <= n_args <= self.nargs):
 *             # TODO(kataoka): Fix error message for nout >= 2 (e.g. divmod)
*/
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_v_n_args = __pyx_t_2;

  /* "cupy/_core/_kernel.pyx":1280
 * 
 *         n_args = len(args)
 *         if not (self.nin <= n_args <= self.nargs):             # <<<<<<<<<<<<<<
 *             # TODO(kataoka): Fix error message for nout >= 2 (e.g. divmod)
 *             raise TypeError(
*/
  __pyx_t_4 = (__pyx_v_self->nin <= __pyx_v_n_args);
  if (__pyx_t_4) {
    __pyx_t_4 = (__pyx_v_n_args <= __pyx_v_self->nargs);
  }
  __pyx_t_9 = (!__pyx_t_4);
  if (unlikely(__pyx_t_9)) {

    /* "cupy/_core/_kernel.pyx":1282
 *         if not (self.nin <= n_args <= self.nargs):
 *             # TODO(kataoka): Fix error message for nout >= 2 (e.g. divmod)
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Wrong number of arguments for {!r}. '
 *                 'It must be either {} or {} (with outputs), '
*/
    __pyx_t_7 = NULL;

    /* "cupy/_core/_kernel.pyx":1285
 *                 'Wrong number of arguments for {!r}. '
 *                 'It must be either {} or {} (with outputs), '
 *                 'but given {}.'.format(             # <<<<<<<<<<<<<<
 *                     self.name, self.nin, self.nargs, n_args))
 * 
*/
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_Wrong_number_of_arguments_for_r;
    __Pyx_INCREF(__pyx_t_6);

    /* "cupy/_core/_kernel.pyx":1286
 *                 'It must be either {} or {} (with outputs), '
 *                 'but given {}.'.format(
 *                     self.name, self.nin, self.nargs, n_args))             # <<<<<<<<<<<<<<
 * 
 *         # parse inputs (positional) and outputs (positional or keyword)
*/
    __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyLong_FromSsize_t(__pyx_v_n_args); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_v_self->name, __pyx_t_3, __pyx_t_10, __pyx_t_11};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (5-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1282, __pyx_L1_error)

    /* "cupy/_core/_kernel.pyx":1280
 * 
 *         n_args = len(args)
 *         if not (self.nin <= n_args <= self.nargs):             # <<<<<<<<<<<<<<
 *             # TODO(kataoka): Fix error message for nout >= 2 (e.g. divmod)
 *             raise TypeError(
*/
  }

  /* "cupy/_core/_kernel.pyx":1289
 * 
 *         # parse inputs (positional) and outputs (positional or keyword)
 *         in_args = args[:self.nin]             # <<<<<<<<<<<<<<
 *         out_args = args[self.nin:]
 * 
*/
  __pyx_t_5 = __Pyx_PyTuple_GetSlice(__pyx_v_args, 0, __pyx_v_self->nin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_in_args = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1290
 *         # parse inputs (positional) and outputs (positional or keyword)
 *         in_args = args[:self.nin]
 *         out_args = args[self.nin:]             # <<<<<<<<<<<<<<
 * 
 *         if out is not None:
*/
  __pyx_t_5 = __Pyx_PyTuple_GetSlice(__pyx_v_args, __pyx_v_self->nin, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out_args = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1292
 *         out_args = args[self.nin:]
 * 
 *         if out is not None:             # <<<<<<<<<<<<<<
 *             if out_args:
 *                 raise ValueError('Cannot specify \'out\' as both '
*/
  __pyx_t_9 = (__pyx_v_out != Py_None);
  if (__pyx_t_9) {

    /* "cupy/_core/_kernel.pyx":1293
 * 
 *         if out is not None:
 *             if out_args:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Cannot specify \'out\' as both '
 *                                  'a positional and keyword argument')
*/
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_out_args); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1293, __pyx_L1_error)
    if (unlikely(__pyx_t_9)) {

      /* "cupy/_core/_kernel.pyx":1294
 *         if out is not None:
 *             if out_args:
 *                 raise ValueError('Cannot specify \'out\' as both '             # <<<<<<<<<<<<<<
 *                                  'a positional and keyword argument')
 *             if isinstance(out, tuple):
*/
      __pyx_t_1 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Cannot_specify_out_as_both_a_pos};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1294, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 1294, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1293
 * 
 *         if out is not None:
 *             if out_args:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Cannot specify \'out\' as both '
 *                                  'a positional and keyword argument')
*/
    }

    /* "cupy/_core/_kernel.pyx":1296
 *                 raise ValueError('Cannot specify \'out\' as both '
 *                                  'a positional and keyword argument')
 *             if isinstance(out, tuple):             # <<<<<<<<<<<<<<
 *                 if len(out) != self.nout:
 *                     raise ValueError(
*/
    __pyx_t_9 = PyTuple_Check(__pyx_v_out); 
    if (__pyx_t_9) {

      /* "cupy/_core/_kernel.pyx":1297
 *                                  'a positional and keyword argument')
 *             if isinstance(out, tuple):
 *                 if len(out) != self.nout:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         "The 'out' tuple must have exactly one entry per "
*/
      __pyx_t_2 = PyObject_Length(__pyx_v_out); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1297, __pyx_L1_error)
      __pyx_t_9 = (__pyx_t_2 != __pyx_v_self->nout);
      if (unlikely(__pyx_t_9)) {

        /* "cupy/_core/_kernel.pyx":1298
 *             if isinstance(out, tuple):
 *                 if len(out) != self.nout:
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         "The 'out' tuple must have exactly one entry per "
 *                         "ufunc output")
*/
        __pyx_t_1 = NULL;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_The_out_tuple_must_have_exactly};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1298, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 1298, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":1297
 *                                  'a positional and keyword argument')
 *             if isinstance(out, tuple):
 *                 if len(out) != self.nout:             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         "The 'out' tuple must have exactly one entry per "
*/
      }

      /* "cupy/_core/_kernel.pyx":1301
 *                         "The 'out' tuple must have exactly one entry per "
 *                         "ufunc output")
 *                 out_args = out             # <<<<<<<<<<<<<<
 *             else:
 *                 if 1 != self.nout:
*/
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_DECREF_SET(__pyx_v_out_args, __pyx_v_out);

      /* "cupy/_core/_kernel.pyx":1296
 *                 raise ValueError('Cannot specify \'out\' as both '
 *                                  'a positional and keyword argument')
 *             if isinstance(out, tuple):             # <<<<<<<<<<<<<<
 *                 if len(out) != self.nout:
 *                     raise ValueError(
*/
      goto __pyx_L13;
    }

    /* "cupy/_core/_kernel.pyx":1303
 *                 out_args = out
 *             else:
 *                 if 1 != self.nout:             # <<<<<<<<<<<<<<
 *                     raise ValueError("'out' must be a tuple of arrays")
 *                 out_args = out,
*/
    /*else*/ {
      __pyx_t_9 = (1 != __pyx_v_self->nout);
      if (unlikely(__pyx_t_9)) {

        /* "cupy/_core/_kernel.pyx":1304
 *             else:
 *                 if 1 != self.nout:
 *                     raise ValueError("'out' must be a tuple of arrays")             # <<<<<<<<<<<<<<
 *                 out_args = out,
 * 
*/
        __pyx_t_1 = NULL;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_out_must_be_a_tuple_of_arrays};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1304, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 1304, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":1303
 *                 out_args = out
 *             else:
 *                 if 1 != self.nout:             # <<<<<<<<<<<<<<
 *                     raise ValueError("'out' must be a tuple of arrays")
 *                 out_args = out,
*/
      }

      /* "cupy/_core/_kernel.pyx":1305
 *                 if 1 != self.nout:
 *                     raise ValueError("'out' must be a tuple of arrays")
 *                 out_args = out,             # <<<<<<<<<<<<<<
 * 
 *         dev_id = device.get_device_id()
*/
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_GIVEREF(__pyx_v_out);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_out_args, __pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L13:;

    /* "cupy/_core/_kernel.pyx":1292
 *         out_args = args[self.nin:]
 * 
 *         if out is not None:             # <<<<<<<<<<<<<<
 *             if out_args:
 *                 raise ValueError('Cannot specify \'out\' as both '
*/
  }

  /* "cupy/_core/_kernel.pyx":1307
 *                 out_args = out,
 * 
 *         dev_id = device.get_device_id()             # <<<<<<<<<<<<<<
 *         in_args = _preprocess_args(dev_id, in_args)
 *         out_args = _preprocess_optional_args(dev_id, out_args)
*/
  __pyx_t_12 = __pyx_f_4cupy_4cuda_6device_get_device_id(0); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1307, __pyx_L1_error)
  __pyx_v_dev_id = __pyx_t_12;

  /* "cupy/_core/_kernel.pyx":1308
 * 
 *         dev_id = device.get_device_id()
 *         in_args = _preprocess_args(dev_id, in_args)             # <<<<<<<<<<<<<<
 *         out_args = _preprocess_optional_args(dev_id, out_args)
 *         given_out_args = [o for o in out_args if o is not None]
*/
  __pyx_t_5 = __pyx_f_4cupy_5_core_7_kernel__preprocess_args(__pyx_v_dev_id, __pyx_v_in_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_in_args, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1309
 *         dev_id = device.get_device_id()
 *         in_args = _preprocess_args(dev_id, in_args)
 *         out_args = _preprocess_optional_args(dev_id, out_args)             # <<<<<<<<<<<<<<
 *         given_out_args = [o for o in out_args if o is not None]
 * 
*/
  __pyx_t_5 = __pyx_f_4cupy_5_core_7_kernel__preprocess_optional_args(__pyx_v_dev_id, __pyx_v_out_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_out_args, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1310
 *         in_args = _preprocess_args(dev_id, in_args)
 *         out_args = _preprocess_optional_args(dev_id, out_args)
 *         given_out_args = [o for o in out_args if o is not None]             # <<<<<<<<<<<<<<
 * 
 *         # TODO(kataoka): Typecheck `in_args` w.r.t. `casting` (before
*/
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1310, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(PyList_CheckExact(__pyx_v_out_args)) || PyTuple_CheckExact(__pyx_v_out_args)) {
      __pyx_t_1 = __pyx_v_out_args; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_out_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1310, __pyx_L18_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1310, __pyx_L18_error)
            #endif
            if (__pyx_t_2 >= __pyx_temp) break;
          }
          __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_2;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1310, __pyx_L18_error)
            #endif
            if (__pyx_t_2 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
          #else
          __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
          #endif
          ++__pyx_t_2;
        }
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L18_error)
      } else {
        __pyx_t_7 = __pyx_t_13(__pyx_t_1);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1310, __pyx_L18_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_o, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_9 = (__pyx_9genexpr13__pyx_v_o != Py_None);
      if (__pyx_t_9) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_9genexpr13__pyx_v_o))) __PYX_ERR(0, 1310, __pyx_L18_error)
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_o); __pyx_9genexpr13__pyx_v_o = 0;
    goto __pyx_L23_exit_scope;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_o); __pyx_9genexpr13__pyx_v_o = 0;
    goto __pyx_L1_error;
    __pyx_L23_exit_scope:;
  } /* exit inner scope */
  __pyx_v_given_out_args = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1314
 *         # TODO(kataoka): Typecheck `in_args` w.r.t. `casting` (before
 *         # broadcast).
 *         if has_where:             # <<<<<<<<<<<<<<
 *             where_args = _preprocess_args(dev_id, (where,))
 *             x = where_args[0]
*/
  if (__pyx_v_has_where) {

    /* "cupy/_core/_kernel.pyx":1315
 *         # broadcast).
 *         if has_where:
 *             where_args = _preprocess_args(dev_id, (where,))             # <<<<<<<<<<<<<<
 *             x = where_args[0]
 *             if isinstance(x, _ndarray_base):
*/
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_where);
    __Pyx_GIVEREF(__pyx_v_where);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_where) != (0)) __PYX_ERR(0, 1315, __pyx_L1_error);
    __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__preprocess_args(__pyx_v_dev_id, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_where_args = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1316
 *         if has_where:
 *             where_args = _preprocess_args(dev_id, (where,))
 *             x = where_args[0]             # <<<<<<<<<<<<<<
 *             if isinstance(x, _ndarray_base):
 *                 # NumPy seems using casting=safe here
*/
    if (unlikely(__pyx_v_where_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1316, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_where_args, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_x = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1317
 *             where_args = _preprocess_args(dev_id, (where,))
 *             x = where_args[0]
 *             if isinstance(x, _ndarray_base):             # <<<<<<<<<<<<<<
 *                 # NumPy seems using casting=safe here
 *                 if x.dtype != bool:
*/
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_x, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    if (__pyx_t_9) {

      /* "cupy/_core/_kernel.pyx":1319
 *             if isinstance(x, _ndarray_base):
 *                 # NumPy seems using casting=safe here
 *                 if x.dtype != bool:             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         f'Cannot cast array data from {x.dtype!r} to '
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)(&PyBool_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1319, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1319, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__pyx_t_9)) {

        /* "cupy/_core/_kernel.pyx":1320
 *                 # NumPy seems using casting=safe here
 *                 if x.dtype != bool:
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         f'Cannot cast array data from {x.dtype!r} to '
 *                         f'{get_dtype(bool)!r} according to the rule \'safe\'')
*/
        __pyx_t_1 = NULL;

        /* "cupy/_core/_kernel.pyx":1321
 *                 if x.dtype != bool:
 *                     raise TypeError(
 *                         f'Cannot cast array data from {x.dtype!r} to '             # <<<<<<<<<<<<<<
 *                         f'{get_dtype(bool)!r} according to the rule \'safe\'')
 *             else:
*/
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_7), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "cupy/_core/_kernel.pyx":1322
 *                     raise TypeError(
 *                         f'Cannot cast array data from {x.dtype!r} to '
 *                         f'{get_dtype(bool)!r} according to the rule \'safe\'')             # <<<<<<<<<<<<<<
 *             else:
 *                 # NumPy does not seem raising TypeError, so just `bool()`.
*/
        __pyx_t_7 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(((PyObject *)(&PyBool_Type)), 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1322, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_7), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1322, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_14[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_cast_array_data_from;
        __pyx_t_14[1] = __pyx_t_11;
        __pyx_t_14[2] = __pyx_mstate_global->__pyx_kp_u_to;
        __pyx_t_14[3] = __pyx_t_10;
        __pyx_t_14[4] = __pyx_mstate_global->__pyx_kp_u_according_to_the_rule_safe;

        /* "cupy/_core/_kernel.pyx":1321
 *                 if x.dtype != bool:
 *                     raise TypeError(
 *                         f'Cannot cast array data from {x.dtype!r} to '             # <<<<<<<<<<<<<<
 *                         f'{get_dtype(bool)!r} according to the rule \'safe\'')
 *             else:
*/
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_14, 5, 28 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 29, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1320, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 1320, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":1319
 *             if isinstance(x, _ndarray_base):
 *                 # NumPy seems using casting=safe here
 *                 if x.dtype != bool:             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         f'Cannot cast array data from {x.dtype!r} to '
*/
      }

      /* "cupy/_core/_kernel.pyx":1317
 *             where_args = _preprocess_args(dev_id, (where,))
 *             x = where_args[0]
 *             if isinstance(x, _ndarray_base):             # <<<<<<<<<<<<<<
 *                 # NumPy seems using casting=safe here
 *                 if x.dtype != bool:
*/
      goto __pyx_L25;
    }

    /* "cupy/_core/_kernel.pyx":1327
 *                 # CuPy does not have to support `where=object()` etc. and
 *                 # `_preprocess_args` rejects it anyway.
 *                 where_args[0] = _scalar.CScalar(bool(x.value))             # <<<<<<<<<<<<<<
 *         else:
 *             where_args = []
*/
    /*else*/ {
      __pyx_t_7 = NULL;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_9))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1327, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }
      if (unlikely(__pyx_v_where_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1327, __pyx_L1_error)
      }
      if (unlikely((__Pyx_SetItemInt(__pyx_v_where_args, 0, ((PyObject *)__pyx_t_5), long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_DECREF((PyObject *)__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L25:;

    /* "cupy/_core/_kernel.pyx":1314
 *         # TODO(kataoka): Typecheck `in_args` w.r.t. `casting` (before
 *         # broadcast).
 *         if has_where:             # <<<<<<<<<<<<<<
 *             where_args = _preprocess_args(dev_id, (where,))
 *             x = where_args[0]
*/
    goto __pyx_L24;
  }

  /* "cupy/_core/_kernel.pyx":1329
 *                 where_args[0] = _scalar.CScalar(bool(x.value))
 *         else:
 *             where_args = []             # <<<<<<<<<<<<<<
 * 
 *         # _copy_in_args_if_needed updates in_args
*/
  /*else*/ {
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_where_args = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L24:;

  /* "cupy/_core/_kernel.pyx":1332
 * 
 *         # _copy_in_args_if_needed updates in_args
 *         _copy_in_args_if_needed(in_args, given_out_args)             # <<<<<<<<<<<<<<
 *         _copy_in_args_if_needed(where_args, given_out_args)
 *         inout_args = in_args + where_args + given_out_args
*/
  __pyx_t_5 = __pyx_v_in_args;
  __Pyx_INCREF(__pyx_t_5);
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_5))) __PYX_ERR(0, 1332, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__copy_in_args_if_needed(((PyObject*)__pyx_t_5), __pyx_v_given_out_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1333
 *         # _copy_in_args_if_needed updates in_args
 *         _copy_in_args_if_needed(in_args, given_out_args)
 *         _copy_in_args_if_needed(where_args, given_out_args)             # <<<<<<<<<<<<<<
 *         inout_args = in_args + where_args + given_out_args
 *         # _broadcast updates shape
*/
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel__copy_in_args_if_needed(__pyx_v_where_args, __pyx_v_given_out_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1334
 *         _copy_in_args_if_needed(in_args, given_out_args)
 *         _copy_in_args_if_needed(where_args, given_out_args)
 *         inout_args = in_args + where_args + given_out_args             # <<<<<<<<<<<<<<
 *         # _broadcast updates shape
 *         internal._broadcast_core(inout_args, shape)
*/
  __pyx_t_1 = PyNumber_Add(__pyx_v_in_args, __pyx_v_where_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_v_given_out_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_5))) __PYX_ERR(0, 1334, __pyx_L1_error)
  __pyx_v_inout_args = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1336
 *         inout_args = in_args + where_args + given_out_args
 *         # _broadcast updates shape
 *         internal._broadcast_core(inout_args, shape)             # <<<<<<<<<<<<<<
 * 
 *         if (self._cutensor_op is not None
*/
  __pyx_t_5 = __pyx_f_4cupy_5_core_8internal__broadcast_core(__pyx_v_inout_args, __pyx_v_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cupy/_core/_kernel.pyx":1338
 *         internal._broadcast_core(inout_args, shape)
 * 
 *         if (self._cutensor_op is not None             # <<<<<<<<<<<<<<
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
*/
  __pyx_t_4 = (__pyx_v_self->_cutensor_op != Py_None);
  if (__pyx_t_4) {
  } else {
    __pyx_t_9 = __pyx_t_4;
    goto __pyx_L28_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":1339
 * 
 *         if (self._cutensor_op is not None
 *                 and _accelerator.ACCELERATOR_CUTENSOR in             # <<<<<<<<<<<<<<
 *                 _accelerator._elementwise_accelerators):
 *             if (self.nin == 2 and self.nout == 1 and
*/
  __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_4cupy_5_core_12_accelerator_ACCELERATOR_CUTENSOR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "cupy/_core/_kernel.pyx":1340
 *         if (self._cutensor_op is not None
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):             # <<<<<<<<<<<<<<
 *             if (self.nin == 2 and self.nout == 1 and
 *                     isinstance(in_args[0], _ndarray_base) and
*/
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_v_4cupy_5_core_12_accelerator__elementwise_accelerators, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __pyx_t_4;
  __pyx_L28_bool_binop_done:;

  /* "cupy/_core/_kernel.pyx":1338
 *         internal._broadcast_core(inout_args, shape)
 * 
 *         if (self._cutensor_op is not None             # <<<<<<<<<<<<<<
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
*/
  if (__pyx_t_9) {

    /* "cupy/_core/_kernel.pyx":1341
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
 *             if (self.nin == 2 and self.nout == 1 and             # <<<<<<<<<<<<<<
 *                     isinstance(in_args[0], _ndarray_base) and
 *                     isinstance(in_args[1], _ndarray_base)):
*/
    __pyx_t_4 = (__pyx_v_self->nin == 2);
    if (__pyx_t_4) {
    } else {
      __pyx_t_9 = __pyx_t_4;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_self->nout == 1);
    if (__pyx_t_4) {
    } else {
      __pyx_t_9 = __pyx_t_4;
      goto __pyx_L31_bool_binop_done;
    }

    /* "cupy/_core/_kernel.pyx":1342
 *                 _accelerator._elementwise_accelerators):
 *             if (self.nin == 2 and self.nout == 1 and
 *                     isinstance(in_args[0], _ndarray_base) and             # <<<<<<<<<<<<<<
 *                     isinstance(in_args[1], _ndarray_base)):
 *                 import cupyx.cutensor
*/
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_in_args, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {
    } else {
      __pyx_t_9 = __pyx_t_4;
      goto __pyx_L31_bool_binop_done;
    }

    /* "cupy/_core/_kernel.pyx":1343
 *             if (self.nin == 2 and self.nout == 1 and
 *                     isinstance(in_args[0], _ndarray_base) and
 *                     isinstance(in_args[1], _ndarray_base)):             # <<<<<<<<<<<<<<
 *                 import cupyx.cutensor
 *                 ret = cupyx.cutensor._try_elementwise_binary_routine(
*/
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_in_args, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __pyx_t_4;
    __pyx_L31_bool_binop_done:;

    /* "cupy/_core/_kernel.pyx":1341
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
 *             if (self.nin == 2 and self.nout == 1 and             # <<<<<<<<<<<<<<
 *                     isinstance(in_args[0], _ndarray_base) and
 *                     isinstance(in_args[1], _ndarray_base)):
*/
    if (__pyx_t_9) {

      /* "cupy/_core/_kernel.pyx":1344
 *                     isinstance(in_args[0], _ndarray_base) and
 *                     isinstance(in_args[1], _ndarray_base)):
 *                 import cupyx.cutensor             # <<<<<<<<<<<<<<
 *                 ret = cupyx.cutensor._try_elementwise_binary_routine(
 *                     in_args[0], in_args[1], dtype,
*/
      __pyx_t_15 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupyx_cutensor, 0, 0, NULL, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1344, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_15;
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_cupyx = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":1345
 *                     isinstance(in_args[1], _ndarray_base)):
 *                 import cupyx.cutensor
 *                 ret = cupyx.cutensor._try_elementwise_binary_routine(             # <<<<<<<<<<<<<<
 *                     in_args[0], in_args[1], dtype,
 *                     out_args[0] if len(out_args) == 1 else None,
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cupyx, __pyx_mstate_global->__pyx_n_u_cutensor); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_1);

      /* "cupy/_core/_kernel.pyx":1346
 *                 import cupyx.cutensor
 *                 ret = cupyx.cutensor._try_elementwise_binary_routine(
 *                     in_args[0], in_args[1], dtype,             # <<<<<<<<<<<<<<
 *                     out_args[0] if len(out_args) == 1 else None,
 *                     self._cutensor_op,
*/
      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_in_args, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_in_args, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);

      /* "cupy/_core/_kernel.pyx":1347
 *                 ret = cupyx.cutensor._try_elementwise_binary_routine(
 *                     in_args[0], in_args[1], dtype,
 *                     out_args[0] if len(out_args) == 1 else None,             # <<<<<<<<<<<<<<
 *                     self._cutensor_op,
 *                     self._cutensor_alpha,
*/
      __pyx_t_2 = PyObject_Length(__pyx_v_out_args); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1347, __pyx_L1_error)
      __pyx_t_9 = (__pyx_t_2 == 1);
      if (__pyx_t_9) {
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_out_args, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_3 = Py_None;
      }

      /* "cupy/_core/_kernel.pyx":1349
 *                     out_args[0] if len(out_args) == 1 else None,
 *                     self._cutensor_op,
 *                     self._cutensor_alpha,             # <<<<<<<<<<<<<<
 *                     self._cutensor_gamma,
 *                 )
*/
      __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_alpha); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);

      /* "cupy/_core/_kernel.pyx":1350
 *                     self._cutensor_op,
 *                     self._cutensor_alpha,
 *                     self._cutensor_gamma,             # <<<<<<<<<<<<<<
 *                 )
 *                 if ret is not None:
*/
      __pyx_t_16 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_gamma); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[8] = {__pyx_t_1, __pyx_t_10, __pyx_t_11, __pyx_v_dtype, __pyx_t_3, __pyx_v_self->_cutensor_op, __pyx_t_6, __pyx_t_16};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_try_elementwise_binary_routine, __pyx_callargs+__pyx_t_8, (8-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1345, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_v_ret = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "cupy/_core/_kernel.pyx":1352
 *                     self._cutensor_gamma,
 *                 )
 *                 if ret is not None:             # <<<<<<<<<<<<<<
 *                     return ret
 * 
*/
      __pyx_t_9 = (__pyx_v_ret != Py_None);
      if (__pyx_t_9) {

        /* "cupy/_core/_kernel.pyx":1353
 *                 )
 *                 if ret is not None:
 *                     return ret             # <<<<<<<<<<<<<<
 * 
 *         op = self._ops.guess_routine(
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_ret);
        __pyx_r = __pyx_v_ret;
        goto __pyx_L0;

        /* "cupy/_core/_kernel.pyx":1352
 *                     self._cutensor_gamma,
 *                 )
 *                 if ret is not None:             # <<<<<<<<<<<<<<
 *                     return ret
 * 
*/
      }

      /* "cupy/_core/_kernel.pyx":1341
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
 *             if (self.nin == 2 and self.nout == 1 and             # <<<<<<<<<<<<<<
 *                     isinstance(in_args[0], _ndarray_base) and
 *                     isinstance(in_args[1], _ndarray_base)):
*/
    }

    /* "cupy/_core/_kernel.pyx":1338
 *         internal._broadcast_core(inout_args, shape)
 * 
 *         if (self._cutensor_op is not None             # <<<<<<<<<<<<<<
 *                 and _accelerator.ACCELERATOR_CUTENSOR in
 *                 _accelerator._elementwise_accelerators):
*/
  }

  /* "cupy/_core/_kernel.pyx":1356
 * 
 *         op = self._ops.guess_routine(
 *             self.name, self._routine_cache, in_args, dtype,             # <<<<<<<<<<<<<<
 *             self._out_ops)
 * 
*/
  __pyx_t_5 = __pyx_v_self->name;
  __Pyx_INCREF(__pyx_t_5);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_5))) __PYX_ERR(0, 1356, __pyx_L1_error)
  __pyx_t_7 = __pyx_v_self->_routine_cache;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_16 = __pyx_v_in_args;
  __Pyx_INCREF(__pyx_t_16);
  if (!(likely(PyList_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_16))) __PYX_ERR(0, 1356, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1357
 *         op = self._ops.guess_routine(
 *             self.name, self._routine_cache, in_args, dtype,
 *             self._out_ops)             # <<<<<<<<<<<<<<
 * 
 *         # Determine a template object from which we initialize the output when
*/
  __pyx_t_6 = ((PyObject *)__pyx_v_self->_out_ops);
  __Pyx_INCREF(__pyx_t_6);

  /* "cupy/_core/_kernel.pyx":1355
 *                     return ret
 * 
 *         op = self._ops.guess_routine(             # <<<<<<<<<<<<<<
 *             self.name, self._routine_cache, in_args, dtype,
 *             self._out_ops)
*/
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops *)__pyx_v_self->_ops->__pyx_vtab)->guess_routine(__pyx_v_self->_ops, ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_7), ((PyObject*)__pyx_t_16), __pyx_v_dtype, ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_6), 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_op = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1361
 *         # Determine a template object from which we initialize the output when
 *         # inputs have subclass instances
 *         def issubclass1(cls, classinfo):             # <<<<<<<<<<<<<<
 *             return issubclass(cls, classinfo) and cls is not classinfo
 *         subtype = cupy.ndarray
*/
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_5ufunc_8__call___1issubclass1, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_issubclass1 = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1363
 *         def issubclass1(cls, classinfo):
 *             return issubclass(cls, classinfo) and cls is not classinfo
 *         subtype = cupy.ndarray             # <<<<<<<<<<<<<<
 *         template = None
 *         for in_arg in in_args:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cupy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_subtype = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1364
 *             return issubclass(cls, classinfo) and cls is not classinfo
 *         subtype = cupy.ndarray
 *         template = None             # <<<<<<<<<<<<<<
 *         for in_arg in in_args:
 *             in_arg_type = type(in_arg)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_template = Py_None;

  /* "cupy/_core/_kernel.pyx":1365
 *         subtype = cupy.ndarray
 *         template = None
 *         for in_arg in in_args:             # <<<<<<<<<<<<<<
 *             in_arg_type = type(in_arg)
 *             if issubclass1(in_arg_type, cupy.ndarray):
*/
  if (unlikely(__pyx_v_in_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1365, __pyx_L1_error)
  }
  __pyx_t_6 = __pyx_v_in_args; __Pyx_INCREF(__pyx_t_6);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1365, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_in_arg, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1366
 *         template = None
 *         for in_arg in in_args:
 *             in_arg_type = type(in_arg)             # <<<<<<<<<<<<<<
 *             if issubclass1(in_arg_type, cupy.ndarray):
 *                 subtype = in_arg_type
*/
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_in_arg)));
    __Pyx_XDECREF_SET(__pyx_v_in_arg_type, ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_in_arg))));

    /* "cupy/_core/_kernel.pyx":1367
 *         for in_arg in in_args:
 *             in_arg_type = type(in_arg)
 *             if issubclass1(in_arg_type, cupy.ndarray):             # <<<<<<<<<<<<<<
 *                 subtype = in_arg_type
 *                 template = in_arg
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cupy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ndarray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {
      #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *__pyx_temp = PyCFunction_GetSelf(__pyx_v_issubclass1);
      if (unlikely(__pyx_temp == NULL && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L1_error)
      #else
      PyObject *__pyx_temp = PyCFunction_GET_SELF(__pyx_v_issubclass1);
      #endif
      __pyx_t_3 = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__call___issubclass1(__pyx_temp, ((PyObject *)__pyx_v_in_arg_type), __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1367, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "cupy/_core/_kernel.pyx":1368
 *             in_arg_type = type(in_arg)
 *             if issubclass1(in_arg_type, cupy.ndarray):
 *                 subtype = in_arg_type             # <<<<<<<<<<<<<<
 *                 template = in_arg
 *                 break
*/
      __Pyx_INCREF((PyObject *)__pyx_v_in_arg_type);
      __Pyx_DECREF_SET(__pyx_v_subtype, ((PyObject *)__pyx_v_in_arg_type));

      /* "cupy/_core/_kernel.pyx":1369
 *             if issubclass1(in_arg_type, cupy.ndarray):
 *                 subtype = in_arg_type
 *                 template = in_arg             # <<<<<<<<<<<<<<
 *                 break
 * 
*/
      __Pyx_INCREF(__pyx_v_in_arg);
      __Pyx_DECREF_SET(__pyx_v_template, __pyx_v_in_arg);

      /* "cupy/_core/_kernel.pyx":1370
 *                 subtype = in_arg_type
 *                 template = in_arg
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         core_in_dtypes, core_out_dtypes = op.resolve_dtypes(in_args, out_args)
*/
      goto __pyx_L37_break;

      /* "cupy/_core/_kernel.pyx":1367
 *         for in_arg in in_args:
 *             in_arg_type = type(in_arg)
 *             if issubclass1(in_arg_type, cupy.ndarray):             # <<<<<<<<<<<<<<
 *                 subtype = in_arg_type
 *                 template = in_arg
*/
    }

    /* "cupy/_core/_kernel.pyx":1365
 *         subtype = cupy.ndarray
 *         template = None
 *         for in_arg in in_args:             # <<<<<<<<<<<<<<
 *             in_arg_type = type(in_arg)
 *             if issubclass1(in_arg_type, cupy.ndarray):
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  goto __pyx_L39_for_end;
  __pyx_L37_break:;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  goto __pyx_L39_for_end;
  __pyx_L39_for_end:;

  /* "cupy/_core/_kernel.pyx":1372
 *                 break
 * 
 *         core_in_dtypes, core_out_dtypes = op.resolve_dtypes(in_args, out_args)             # <<<<<<<<<<<<<<
 * 
 *         out_args = _get_out_args_from_optionals(
*/
  __pyx_t_6 = __pyx_v_in_args;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_6))) __PYX_ERR(0, 1372, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_out_args;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_3))) __PYX_ERR(0, 1372, __pyx_L1_error)
  __pyx_t_16 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op *)__pyx_v_op->__pyx_vtab)->resolve_dtypes(__pyx_v_op, ((PyObject*)__pyx_t_6), ((PyObject*)__pyx_t_3), 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_16 != Py_None)) {
    PyObject* sequence = __pyx_t_16;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1372, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1372, __pyx_L1_error)
  }
  __pyx_v_core_in_dtypes = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_core_out_dtypes = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1375
 * 
 *         out_args = _get_out_args_from_optionals(
 *             subtype, out_args, core_out_dtypes, shape, casting, template)             # <<<<<<<<<<<<<<
 *         # inout_args may have included given outputs for broadcasting, replace:
 *         inout_args[len(in_args) + has_where:] = out_args
*/
  __pyx_t_16 = __pyx_v_out_args;
  __Pyx_INCREF(__pyx_t_16);
  if (!(likely(PyList_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_16))) __PYX_ERR(0, 1375, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_core_out_dtypes;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyTuple_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_6))) __PYX_ERR(0, 1375, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1374
 *         core_in_dtypes, core_out_dtypes = op.resolve_dtypes(in_args, out_args)
 * 
 *         out_args = _get_out_args_from_optionals(             # <<<<<<<<<<<<<<
 *             subtype, out_args, core_out_dtypes, shape, casting, template)
 *         # inout_args may have included given outputs for broadcasting, replace:
*/
  __pyx_t_3 = __pyx_f_4cupy_5_core_7_kernel__get_out_args_from_optionals(__pyx_v_subtype, ((PyObject*)__pyx_t_16), ((PyObject*)__pyx_t_6), __pyx_v_shape, __pyx_v_casting, __pyx_v_template); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_out_args, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1377
 *             subtype, out_args, core_out_dtypes, shape, casting, template)
 *         # inout_args may have included given outputs for broadcasting, replace:
 *         inout_args[len(in_args) + has_where:] = out_args             # <<<<<<<<<<<<<<
 * 
 *         if self.nout == 1:
*/
  if (unlikely(__pyx_v_inout_args == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1377, __pyx_L1_error)
  }
  __pyx_t_2 = PyObject_Length(__pyx_v_in_args); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1377, __pyx_L1_error)
  if (__Pyx_PyObject_SetSlice(__pyx_v_inout_args, __pyx_v_out_args, (__pyx_t_2 + __pyx_v_has_where), 0, NULL, NULL, NULL, 1, 0, 1) < (0)) __PYX_ERR(0, 1377, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1379
 *         inout_args[len(in_args) + has_where:] = out_args
 * 
 *         if self.nout == 1:             # <<<<<<<<<<<<<<
 *             ret = out_args[0]
 *         else:
*/
  __pyx_t_9 = (__pyx_v_self->nout == 1);
  if (__pyx_t_9) {

    /* "cupy/_core/_kernel.pyx":1380
 * 
 *         if self.nout == 1:
 *             ret = out_args[0]             # <<<<<<<<<<<<<<
 *         else:
 *             ret = tuple(out_args)
*/
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1380, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_out_args, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_ret, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1379
 *         inout_args[len(in_args) + has_where:] = out_args
 * 
 *         if self.nout == 1:             # <<<<<<<<<<<<<<
 *             ret = out_args[0]
 *         else:
*/
    goto __pyx_L40;
  }

  /* "cupy/_core/_kernel.pyx":1382
 *             ret = out_args[0]
 *         else:
 *             ret = tuple(out_args)             # <<<<<<<<<<<<<<
 * 
 *         if _contains_zero(shape):
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_out_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_ret, __pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L40:;

  /* "cupy/_core/_kernel.pyx":1384
 *             ret = tuple(out_args)
 * 
 *         if _contains_zero(shape):             # <<<<<<<<<<<<<<
 *             return ret
 * 
*/
  __pyx_t_9 = __pyx_f_4cupy_5_core_7_kernel__contains_zero(__pyx_v_shape); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1384, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "cupy/_core/_kernel.pyx":1385
 * 
 *         if _contains_zero(shape):
 *             return ret             # <<<<<<<<<<<<<<
 * 
 *         for i, t in enumerate(core_in_dtypes):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_ret);
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1384
 *             ret = tuple(out_args)
 * 
 *         if _contains_zero(shape):             # <<<<<<<<<<<<<<
 *             return ret
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1387
 *             return ret
 * 
 *         for i, t in enumerate(core_in_dtypes):             # <<<<<<<<<<<<<<
 *             # If necessary, cast scalars here (deals with Python ints also)
 *             if type(inout_args[i]) is _scalar.CScalar:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __pyx_t_3 = __pyx_mstate_global->__pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_core_in_dtypes)) || PyTuple_CheckExact(__pyx_v_core_in_dtypes)) {
    __pyx_t_6 = __pyx_v_core_in_dtypes; __Pyx_INCREF(__pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_core_in_dtypes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1387, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1387, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_16 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1387, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_16 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2));
        #else
        __pyx_t_16 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1387, __pyx_L1_error)
    } else {
      __pyx_t_16 = __pyx_t_13(__pyx_t_6);
      if (unlikely(!__pyx_t_16)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1387, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_16);
    __pyx_t_16 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_16 = __Pyx_PyLong_AddObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_16;
    __pyx_t_16 = 0;

    /* "cupy/_core/_kernel.pyx":1389
 *         for i, t in enumerate(core_in_dtypes):
 *             # If necessary, cast scalars here (deals with Python ints also)
 *             if type(inout_args[i]) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                 (<_scalar.CScalar>inout_args[i]).apply_dtype(t)
 * 
*/
    if (unlikely(__pyx_v_inout_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1389, __pyx_L1_error)
    }
    __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_inout_args, __pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_9 = (((PyObject *)Py_TYPE(__pyx_t_16)) == ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar));
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (__pyx_t_9) {

      /* "cupy/_core/_kernel.pyx":1390
 *             # If necessary, cast scalars here (deals with Python ints also)
 *             if type(inout_args[i]) is _scalar.CScalar:
 *                 (<_scalar.CScalar>inout_args[i]).apply_dtype(t)             # <<<<<<<<<<<<<<
 * 
 *         shape = _reduce_dims(inout_args, self._params, shape)
*/
      if (unlikely(__pyx_v_inout_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1390, __pyx_L1_error)
      }
      __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_inout_args, __pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_7 = ((struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar *)((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_t_16)->__pyx_vtab)->apply_dtype(((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_t_16), __pyx_v_t, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cupy/_core/_kernel.pyx":1389
 *         for i, t in enumerate(core_in_dtypes):
 *             # If necessary, cast scalars here (deals with Python ints also)
 *             if type(inout_args[i]) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                 (<_scalar.CScalar>inout_args[i]).apply_dtype(t)
 * 
*/
    }

    /* "cupy/_core/_kernel.pyx":1387
 *             return ret
 * 
 *         for i, t in enumerate(core_in_dtypes):             # <<<<<<<<<<<<<<
 *             # If necessary, cast scalars here (deals with Python ints also)
 *             if type(inout_args[i]) is _scalar.CScalar:
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1392
 *                 (<_scalar.CScalar>inout_args[i]).apply_dtype(t)
 * 
 *         shape = _reduce_dims(inout_args, self._params, shape)             # <<<<<<<<<<<<<<
 *         indexer = _carray._indexer_init(shape)
 *         inout_args.append(indexer)
*/
  __pyx_t_3 = __pyx_v_self->_params;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_17 = __pyx_f_4cupy_5_core_7_kernel__reduce_dims(__pyx_v_inout_args, ((PyObject*)__pyx_t_3), __pyx_v_shape); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_shape = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_17);

  /* "cupy/_core/_kernel.pyx":1393
 * 
 *         shape = _reduce_dims(inout_args, self._params, shape)
 *         indexer = _carray._indexer_init(shape)             # <<<<<<<<<<<<<<
 *         inout_args.append(indexer)
 *         arginfos = _get_arginfos(inout_args)
*/
  __pyx_t_3 = ((PyObject *)__pyx_f_4cupy_5_core_7_carray__indexer_init(__pyx_v_shape)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_indexer = ((struct __pyx_obj_4cupy_5_core_7_carray_Indexer *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1394
 *         shape = _reduce_dims(inout_args, self._params, shape)
 *         indexer = _carray._indexer_init(shape)
 *         inout_args.append(indexer)             # <<<<<<<<<<<<<<
 *         arginfos = _get_arginfos(inout_args)
 * 
*/
  if (unlikely(__pyx_v_inout_args == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 1394, __pyx_L1_error)
  }
  __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_inout_args, ((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 1394, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1395
 *         indexer = _carray._indexer_init(shape)
 *         inout_args.append(indexer)
 *         arginfos = _get_arginfos(inout_args)             # <<<<<<<<<<<<<<
 * 
 *         kern = self._get_ufunc_kernel(
*/
  __pyx_t_3 = __pyx_f_4cupy_5_core_7_kernel__get_arginfos(__pyx_v_inout_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_arginfos = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1398
 * 
 *         kern = self._get_ufunc_kernel(
 *             core_in_dtypes, core_out_dtypes, dev_id, op, arginfos, has_where)             # <<<<<<<<<<<<<<
 * 
 *         kern.linear_launch(indexer.size, inout_args)
*/
  __pyx_t_3 = __pyx_v_core_in_dtypes;
  __Pyx_INCREF(__pyx_t_3);
  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_3))) __PYX_ERR(0, 1398, __pyx_L1_error)
  __pyx_t_6 = __pyx_v_core_out_dtypes;
  __Pyx_INCREF(__pyx_t_6);
  if (!(likely(PyTuple_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_6))) __PYX_ERR(0, 1398, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1397
 *         arginfos = _get_arginfos(inout_args)
 * 
 *         kern = self._get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *             core_in_dtypes, core_out_dtypes, dev_id, op, arginfos, has_where)
 * 
*/
  __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self->__pyx_vtab)->_get_ufunc_kernel(__pyx_v_self, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_6), __pyx_v_dev_id, __pyx_v_op, __pyx_v_arginfos, __pyx_v_has_where)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_kern = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "cupy/_core/_kernel.pyx":1400
 *             core_in_dtypes, core_out_dtypes, dev_id, op, arginfos, has_where)
 * 
 *         kern.linear_launch(indexer.size, inout_args)             # <<<<<<<<<<<<<<
 *         return ret
 * 
*/
  __pyx_t_7 = ((struct __pyx_vtabstruct_4cupy_4cuda_8function_Function *)__pyx_v_kern->__pyx_vtab)->linear_launch(__pyx_v_kern, __pyx_v_indexer->size, __pyx_v_inout_args, 0, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "cupy/_core/_kernel.pyx":1401
 * 
 *         kern.linear_launch(indexer.size, inout_args)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1241
 *         return types
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Applies the universal function to arguments elementwise.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF((PyObject *)__pyx_v_kern);
  __Pyx_XDECREF(__pyx_v_inout_args);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_where);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_casting);
  __Pyx_XDECREF(__pyx_v_in_args);
  __Pyx_XDECREF(__pyx_v_out_args);
  __Pyx_XDECREF(__pyx_v_given_out_args);
  __Pyx_XDECREF(__pyx_v_where_args);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_cupyx);
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_issubclass1);
  __Pyx_XDECREF(__pyx_v_subtype);
  __Pyx_XDECREF(__pyx_v_template);
  __Pyx_XDECREF(__pyx_v_in_arg);
  __Pyx_XDECREF((PyObject *)__pyx_v_in_arg_type);
  __Pyx_XDECREF(__pyx_v_core_in_dtypes);
  __Pyx_XDECREF(__pyx_v_core_out_dtypes);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF(__pyx_v_arginfos);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1403
 *         return ret
 * 
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):             # <<<<<<<<<<<<<<
 *         cdef str name = self.name
 *         if has_where:
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_name_with_type(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_arginfos, int __pyx_v_has_where) {
  PyObject *__pyx_v_name = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v_arginfo = 0;
  PyObject *__pyx_v_inout_type_words = NULL;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_name_with_type", 0);

  /* "cupy/_core/_kernel.pyx":1404
 * 
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):
 *         cdef str name = self.name             # <<<<<<<<<<<<<<
 *         if has_where:
 *             name += '_where'
*/
  __pyx_t_1 = __pyx_v_self->name;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 1404, __pyx_L1_error)
  __pyx_v_name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1405
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):
 *         cdef str name = self.name
 *         if has_where:             # <<<<<<<<<<<<<<
 *             name += '_where'
 *         cdef _ArgInfo arginfo
*/
  if (__pyx_v_has_where) {

    /* "cupy/_core/_kernel.pyx":1406
 *         cdef str name = self.name
 *         if has_where:
 *             name += '_where'             # <<<<<<<<<<<<<<
 *         cdef _ArgInfo arginfo
 *         inout_type_words = []
*/
    __pyx_t_1 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_v_name, __pyx_mstate_global->__pyx_n_u_where); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1405
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):
 *         cdef str name = self.name
 *         if has_where:             # <<<<<<<<<<<<<<
 *             name += '_where'
 *         cdef _ArgInfo arginfo
*/
  }

  /* "cupy/_core/_kernel.pyx":1408
 *             name += '_where'
 *         cdef _ArgInfo arginfo
 *         inout_type_words = []             # <<<<<<<<<<<<<<
 *         for arginfo in arginfos:
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_inout_type_words = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1409
 *         cdef _ArgInfo arginfo
 *         inout_type_words = []
 *         for arginfo in arginfos:             # <<<<<<<<<<<<<<
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
 *             if arginfo.is_ndarray():
*/
  if (unlikely(__pyx_v_arginfos == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1409, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_arginfos; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1409, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo))))) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_arginfo, ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1410
 *         inout_type_words = []
 *         for arginfo in arginfos:
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!             # <<<<<<<<<<<<<<
 *             if arginfo.is_ndarray():
 *                 inout_type_words.append(dtype)
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_arginfo->dtype};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_dtype, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1411
 *         for arginfo in arginfos:
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
 *             if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *                 inout_type_words.append(dtype)
 *             elif arginfo.is_scalar():
*/
    __pyx_t_8 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->is_ndarray(__pyx_v_arginfo);
    if (__pyx_t_8) {

      /* "cupy/_core/_kernel.pyx":1412
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
 *             if arginfo.is_ndarray():
 *                 inout_type_words.append(dtype)             # <<<<<<<<<<<<<<
 *             elif arginfo.is_scalar():
 *                 inout_type_words.append(dtype.rstrip('0123456789'))
*/
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_inout_type_words, __pyx_v_dtype); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1412, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1411
 *         for arginfo in arginfos:
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
 *             if arginfo.is_ndarray():             # <<<<<<<<<<<<<<
 *                 inout_type_words.append(dtype)
 *             elif arginfo.is_scalar():
*/
      goto __pyx_L6;
    }

    /* "cupy/_core/_kernel.pyx":1413
 *             if arginfo.is_ndarray():
 *                 inout_type_words.append(dtype)
 *             elif arginfo.is_scalar():             # <<<<<<<<<<<<<<
 *                 inout_type_words.append(dtype.rstrip('0123456789'))
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))
*/
    __pyx_t_8 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v_arginfo->__pyx_vtab)->is_scalar(__pyx_v_arginfo);
    if (__pyx_t_8) {

      /* "cupy/_core/_kernel.pyx":1414
 *                 inout_type_words.append(dtype)
 *             elif arginfo.is_scalar():
 *                 inout_type_words.append(dtype.rstrip('0123456789'))             # <<<<<<<<<<<<<<
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))
 * 
*/
      __pyx_t_3 = __pyx_v_dtype;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_0123456789};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rstrip, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_inout_type_words, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "cupy/_core/_kernel.pyx":1413
 *             if arginfo.is_ndarray():
 *                 inout_type_words.append(dtype)
 *             elif arginfo.is_scalar():             # <<<<<<<<<<<<<<
 *                 inout_type_words.append(dtype.rstrip('0123456789'))
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))
*/
    }
    __pyx_L6:;

    /* "cupy/_core/_kernel.pyx":1409
 *         cdef _ArgInfo arginfo
 *         inout_type_words = []
 *         for arginfo in arginfos:             # <<<<<<<<<<<<<<
 *             dtype = numpy.dtype(arginfo.dtype).name  # TODO: better scheme!
 *             if arginfo.is_ndarray():
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1415
 *             elif arginfo.is_scalar():
 *                 inout_type_words.append(dtype.rstrip('0123456789'))
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))             # <<<<<<<<<<<<<<
 * 
 *     cdef function.Function _get_ufunc_kernel(
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u__18;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_3 = PyUnicode_Join(__pyx_mstate_global->__pyx_n_u__19, __pyx_v_inout_type_words); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_name, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1403
 *         return ret
 * 
 *     cdef str _get_name_with_type(self, tuple arginfos, bint has_where):             # <<<<<<<<<<<<<<
 *         cdef str name = self.name
 *         if has_where:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc._get_name_with_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF((PyObject *)__pyx_v_arginfo);
  __Pyx_XDECREF(__pyx_v_inout_type_words);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1417
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))
 * 
 *     cdef function.Function _get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *             self, tuple in_dtypes, tuple out_dtypes,
 *             int dev_id, _Op op, tuple arginfos, bint has_where):
*/

static struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_ufunc_kernel(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_in_dtypes, PyObject *__pyx_v_out_dtypes, int __pyx_v_dev_id, struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_op, PyObject *__pyx_v_arginfos, int __pyx_v_has_where) {
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_v_kern = 0;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_params = NULL;
  struct __pyx_obj_4cupy_4cuda_8function_Function *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_ufunc_kernel", 0);

  /* "cupy/_core/_kernel.pyx":1421
 *             int dev_id, _Op op, tuple arginfos, bint has_where):
 *         cdef function.Function kern
 *         key = (dev_id, op, arginfos, has_where)             # <<<<<<<<<<<<<<
 *         kern = self._kernel_memo.get(key, None)
 *         if kern is None:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dev_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_has_where); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1421, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __Pyx_GIVEREF((PyObject *)__pyx_v_op);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_op)) != (0)) __PYX_ERR(0, 1421, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_arginfos);
  __Pyx_GIVEREF(__pyx_v_arginfos);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_arginfos) != (0)) __PYX_ERR(0, 1421, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2) != (0)) __PYX_ERR(0, 1421, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_key = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1422
 *         cdef function.Function kern
 *         key = (dev_id, op, arginfos, has_where)
 *         kern = self._kernel_memo.get(key, None)             # <<<<<<<<<<<<<<
 *         if kern is None:
 *             name = self._get_name_with_type(arginfos, has_where)
*/
  if (unlikely(__pyx_v_self->_kernel_memo == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 1422, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->_kernel_memo, __pyx_v_key, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 1422, __pyx_L1_error)
  __pyx_v_kern = ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1423
 *         key = (dev_id, op, arginfos, has_where)
 *         kern = self._kernel_memo.get(key, None)
 *         if kern is None:             # <<<<<<<<<<<<<<
 *             name = self._get_name_with_type(arginfos, has_where)
 *             params = self._params_with_where if has_where else self._params
*/
  __pyx_t_4 = (((PyObject *)__pyx_v_kern) == Py_None);
  if (__pyx_t_4) {

    /* "cupy/_core/_kernel.pyx":1424
 *         kern = self._kernel_memo.get(key, None)
 *         if kern is None:
 *             name = self._get_name_with_type(arginfos, has_where)             # <<<<<<<<<<<<<<
 *             params = self._params_with_where if has_where else self._params
 *             kern = _get_ufunc_kernel(
*/
    __pyx_t_3 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self->__pyx_vtab)->_get_name_with_type(__pyx_v_self, __pyx_v_arginfos, __pyx_v_has_where); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_name = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1425
 *         if kern is None:
 *             name = self._get_name_with_type(arginfos, has_where)
 *             params = self._params_with_where if has_where else self._params             # <<<<<<<<<<<<<<
 *             kern = _get_ufunc_kernel(
 *                 in_dtypes, out_dtypes, op.routine, arginfos, has_where,
*/
    if (__pyx_v_has_where) {
      __Pyx_INCREF(__pyx_v_self->_params_with_where);
      __pyx_t_3 = __pyx_v_self->_params_with_where;
    } else {
      __Pyx_INCREF(__pyx_v_self->_params);
      __pyx_t_3 = __pyx_v_self->_params;
    }
    __pyx_v_params = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1427
 *             params = self._params_with_where if has_where else self._params
 *             kern = _get_ufunc_kernel(
 *                 in_dtypes, out_dtypes, op.routine, arginfos, has_where,             # <<<<<<<<<<<<<<
 *                 params, name, self._preamble, self._loop_prep)
 *             kern = self._kernel_memo.setdefault(key, kern)
*/
    __pyx_t_3 = __pyx_v_op->routine;
    __Pyx_INCREF(__pyx_t_3);

    /* "cupy/_core/_kernel.pyx":1428
 *             kern = _get_ufunc_kernel(
 *                 in_dtypes, out_dtypes, op.routine, arginfos, has_where,
 *                 params, name, self._preamble, self._loop_prep)             # <<<<<<<<<<<<<<
 *             kern = self._kernel_memo.setdefault(key, kern)
 *         return kern
*/
    __pyx_t_2 = __pyx_v_self->_preamble;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_v_self->_loop_prep;
    __Pyx_INCREF(__pyx_t_1);

    /* "cupy/_core/_kernel.pyx":1426
 *             name = self._get_name_with_type(arginfos, has_where)
 *             params = self._params_with_where if has_where else self._params
 *             kern = _get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *                 in_dtypes, out_dtypes, op.routine, arginfos, has_where,
 *                 params, name, self._preamble, self._loop_prep)
*/
    __pyx_t_5 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel__get_ufunc_kernel(__pyx_v_in_dtypes, __pyx_v_out_dtypes, __pyx_t_3, __pyx_v_arginfos, __pyx_v_has_where, __pyx_v_params, __pyx_v_name, __pyx_t_2, __pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_kern, ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1429
 *                 in_dtypes, out_dtypes, op.routine, arginfos, has_where,
 *                 params, name, self._preamble, self._loop_prep)
 *             kern = self._kernel_memo.setdefault(key, kern)             # <<<<<<<<<<<<<<
 *         return kern
 * 
*/
    if (unlikely(__pyx_v_self->_kernel_memo == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault");
      __PYX_ERR(0, 1429, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyDict_SetDefault(__pyx_v_self->_kernel_memo, __pyx_v_key, ((PyObject *)__pyx_v_kern)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_4cupy_4cuda_8function_Function))))) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_kern, ((struct __pyx_obj_4cupy_4cuda_8function_Function *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "cupy/_core/_kernel.pyx":1423
 *         key = (dev_id, op, arginfos, has_where)
 *         kern = self._kernel_memo.get(key, None)
 *         if kern is None:             # <<<<<<<<<<<<<<
 *             name = self._get_name_with_type(arginfos, has_where)
 *             params = self._params_with_where if has_where else self._params
*/
  }

  /* "cupy/_core/_kernel.pyx":1430
 *                 params, name, self._preamble, self._loop_prep)
 *             kern = self._kernel_memo.setdefault(key, kern)
 *         return kern             # <<<<<<<<<<<<<<
 * 
 *     def outer(self, A, B, **kwargs):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_kern);
  __pyx_r = __pyx_v_kern;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1417
 *         return '{}__{}'.format(name, '_'.join(inout_type_words))
 * 
 *     cdef function.Function _get_ufunc_kernel(             # <<<<<<<<<<<<<<
 *             self, tuple in_dtypes, tuple out_dtypes,
 *             int dev_id, _Op op, tuple arginfos, bint has_where):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc._get_ufunc_kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_kern);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_params);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1432
 *         return kern
 * 
 *     def outer(self, A, B, **kwargs):             # <<<<<<<<<<<<<<
 *         """Apply the ufunc operation to all pairs of elements in A and B.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7outer(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_6outer, "ufunc.outer(self, A, B, **kwargs)\n\nApply the ufunc operation to all pairs of elements in A and B.\n\n.. seealso::\n   :meth:`numpy.ufunc.outer`");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7outer(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outer (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_A,&__pyx_mstate_global->__pyx_n_u_B,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1432, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1432, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1432, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "outer", 1) < (0)) __PYX_ERR(0, 1432, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("outer", 1, 2, 2, i); __PYX_ERR(0, 1432, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1432, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1432, __pyx_L3_error)
    }
    __pyx_v_A = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outer", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1432, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.outer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_6outer(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_6outer(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_ndim_a = NULL;
  PyObject *__pyx_v_ndim_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outer", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);

  /* "cupy/_core/_kernel.pyx":1439
 * 
 *         """
 *         A = core.array(A)             # <<<<<<<<<<<<<<
 *         B = core.array(B)
 *         ndim_a = A.ndim
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_4core_array(__pyx_v_A, 0, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1440
 *         """
 *         A = core.array(A)
 *         B = core.array(B)             # <<<<<<<<<<<<<<
 *         ndim_a = A.ndim
 *         ndim_b = B.ndim
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_4core_array(__pyx_v_B, 0, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1441
 *         A = core.array(A)
 *         B = core.array(B)
 *         ndim_a = A.ndim             # <<<<<<<<<<<<<<
 *         ndim_b = B.ndim
 *         A = A.reshape(A.shape + (1,) * ndim_b)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ndim_a = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1442
 *         B = core.array(B)
 *         ndim_a = A.ndim
 *         ndim_b = B.ndim             # <<<<<<<<<<<<<<
 *         A = A.reshape(A.shape + (1,) * ndim_b)
 *         B = B.reshape((1,) * ndim_a + B.shape)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_B, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ndim_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1443
 *         ndim_a = A.ndim
 *         ndim_b = B.ndim
 *         A = A.reshape(A.shape + (1,) * ndim_b)             # <<<<<<<<<<<<<<
 *         B = B.reshape((1,) * ndim_a + B.shape)
 *         return self(A, B, **kwargs)
*/
  __pyx_t_2 = __pyx_v_A;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Multiply(__pyx_mstate_global->__pyx_tuple[3], __pyx_v_ndim_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1444
 *         ndim_b = B.ndim
 *         A = A.reshape(A.shape + (1,) * ndim_b)
 *         B = B.reshape((1,) * ndim_a + B.shape)             # <<<<<<<<<<<<<<
 *         return self(A, B, **kwargs)
 * 
*/
  __pyx_t_5 = __pyx_v_B;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_2 = PyNumber_Multiply(__pyx_mstate_global->__pyx_tuple[3], __pyx_v_ndim_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_B, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1445
 *         A = A.reshape(A.shape + (1,) * ndim_b)
 *         B = B.reshape((1,) * ndim_a + B.shape)
 *         return self(A, B, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def at(self, a, indices, b=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_t_5 = ((PyObject *)__pyx_v_self); 
  __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_A, __pyx_v_B};
    __pyx_t_1 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1432
 *         return kern
 * 
 *     def outer(self, A, B, **kwargs):             # <<<<<<<<<<<<<<
 *         """Apply the ufunc operation to all pairs of elements in A and B.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.outer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ndim_a);
  __Pyx_XDECREF(__pyx_v_ndim_b);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1447
 *         return self(A, B, **kwargs)
 * 
 *     def at(self, a, indices, b=None):             # <<<<<<<<<<<<<<
 *         """Apply in place operation on the operand ``a`` for elements
 *         specified by ``indices``.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_9at(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_8at, "ufunc.at(self, a, indices, b=None)\n\nApply in place operation on the operand ``a`` for elements\nspecified by ``indices``.\n\n.. seealso::\n   :meth:`numpy.ufunc.at`");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_9at(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_b = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("at (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_indices,&__pyx_mstate_global->__pyx_n_u_b,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1447, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1447, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1447, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1447, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "at", 0) < (0)) __PYX_ERR(0, 1447, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("at", 0, 2, 3, i); __PYX_ERR(0, 1447, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1447, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1447, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1447, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_a = values[0];
    __pyx_v_indices = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("at", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1447, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8at(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_a, __pyx_v_indices, __pyx_v_b);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8at(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_indices, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("at", 0);

  /* "cupy/_core/_kernel.pyx":1454
 *            :meth:`numpy.ufunc.at`
 *         """
 *         if self._scatter_op is not None:             # <<<<<<<<<<<<<<
 *             a._scatter_op(indices, b, self._scatter_op)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_self->_scatter_op != ((PyObject*)Py_None));
  if (likely(__pyx_t_1)) {

    /* "cupy/_core/_kernel.pyx":1455
 *         """
 *         if self._scatter_op is not None:
 *             a._scatter_op(indices, b, self._scatter_op)             # <<<<<<<<<<<<<<
 *         else:
 *             raise NotImplementedError(f'`{self.name}.at` is not supported yet')
*/
    __pyx_t_3 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_indices, __pyx_v_b, __pyx_v_self->_scatter_op};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_scatter_op_2, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1454
 *            :meth:`numpy.ufunc.at`
 *         """
 *         if self._scatter_op is not None:             # <<<<<<<<<<<<<<
 *             a._scatter_op(indices, b, self._scatter_op)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1457
 *             a._scatter_op(indices, b, self._scatter_op)
 *         else:
 *             raise NotImplementedError(f'`{self.name}.at` is not supported yet')             # <<<<<<<<<<<<<<
 * 
 *     def reduce(self, array, axis=0, dtype=None, out=None, keepdims=False):
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_self->name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__20;
    __pyx_t_6[1] = __pyx_t_5;
    __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_at_is_not_supported_yet;
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 25, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1457, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1457, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1447
 *         return self(A, B, **kwargs)
 * 
 *     def at(self, a, indices, b=None):             # <<<<<<<<<<<<<<
 *         """Apply in place operation on the operand ``a`` for elements
 *         specified by ``indices``.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1459
 *             raise NotImplementedError(f'`{self.name}.at` is not supported yet')
 * 
 *     def reduce(self, array, axis=0, dtype=None, out=None, keepdims=False):             # <<<<<<<<<<<<<<
 *         """Reduce ``array`` applying ufunc.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_11reduce(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_10reduce, "ufunc.reduce(self, array, axis=0, dtype=None, out=None, keepdims=False)\n\nReduce ``array`` applying ufunc.\n\n.. seealso::\n   :meth:`numpy.ufunc.reduce`");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_11reduce(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_dtype = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_keepdims = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reduce (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_array,&__pyx_mstate_global->__pyx_n_u_axis,&__pyx_mstate_global->__pyx_n_u_dtype,&__pyx_mstate_global->__pyx_n_u_out,&__pyx_mstate_global->__pyx_n_u_keepdims,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1459, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "reduce", 0) < (0)) __PYX_ERR(0, 1459, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("reduce", 0, 1, 5, i); __PYX_ERR(0, 1459, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1459, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1459, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_array = values[0];
    __pyx_v_axis = values[1];
    __pyx_v_dtype = values[2];
    __pyx_v_out = values[3];
    __pyx_v_keepdims = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reduce", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 1459, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.reduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_10reduce(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_array, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out, __pyx_v_keepdims);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_10reduce(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out, PyObject *__pyx_v_keepdims) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reduce", 0);

  /* "cupy/_core/_kernel.pyx":1465
 *            :meth:`numpy.ufunc.reduce`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array.sum(axis, dtype, out, keepdims)
 *         if self.name == 'cupy_multiply':
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_mstate_global->__pyx_n_u_cupy_add, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1465, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1466
 *         """
 *         if self.name == 'cupy_add':
 *             return array.sum(axis, dtype, out, keepdims)             # <<<<<<<<<<<<<<
 *         if self.name == 'cupy_multiply':
 *             return array.prod(axis, dtype, out, keepdims)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_array;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out, __pyx_v_keepdims};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1465
 *            :meth:`numpy.ufunc.reduce`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array.sum(axis, dtype, out, keepdims)
 *         if self.name == 'cupy_multiply':
*/
  }

  /* "cupy/_core/_kernel.pyx":1467
 *         if self.name == 'cupy_add':
 *             return array.sum(axis, dtype, out, keepdims)
 *         if self.name == 'cupy_multiply':             # <<<<<<<<<<<<<<
 *             return array.prod(axis, dtype, out, keepdims)
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_mstate_global->__pyx_n_u_cupy_multiply, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1467, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1468
 *             return array.sum(axis, dtype, out, keepdims)
 *         if self.name == 'cupy_multiply':
 *             return array.prod(axis, dtype, out, keepdims)             # <<<<<<<<<<<<<<
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_array;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out, __pyx_v_keepdims};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_prod, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1467
 *         if self.name == 'cupy_add':
 *             return array.sum(axis, dtype, out, keepdims)
 *         if self.name == 'cupy_multiply':             # <<<<<<<<<<<<<<
 *             return array.prod(axis, dtype, out, keepdims)
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')
*/
  }

  /* "cupy/_core/_kernel.pyx":1469
 *         if self.name == 'cupy_multiply':
 *             return array.prod(axis, dtype, out, keepdims)
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')             # <<<<<<<<<<<<<<
 * 
 *     def accumulate(self, array, axis=0, dtype=None, out=None):
*/
  __pyx_t_3 = NULL;
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_self->name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__20;
  __pyx_t_6[1] = __pyx_t_5;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_reduce_is_not_supported_yet;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 29, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 1469, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1459
 *             raise NotImplementedError(f'`{self.name}.at` is not supported yet')
 * 
 *     def reduce(self, array, axis=0, dtype=None, out=None, keepdims=False):             # <<<<<<<<<<<<<<
 *         """Reduce ``array`` applying ufunc.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.reduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1471
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')
 * 
 *     def accumulate(self, array, axis=0, dtype=None, out=None):             # <<<<<<<<<<<<<<
 *         """Accumulate ``array`` applying ufunc.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_13accumulate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_12accumulate, "ufunc.accumulate(self, array, axis=0, dtype=None, out=None)\n\nAccumulate ``array`` applying ufunc.\n\n.. seealso::\n   :meth:`numpy.ufunc.accumulate`");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_13accumulate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_dtype = 0;
  PyObject *__pyx_v_out = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accumulate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_array,&__pyx_mstate_global->__pyx_n_u_axis,&__pyx_mstate_global->__pyx_n_u_dtype,&__pyx_mstate_global->__pyx_n_u_out,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1471, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "accumulate", 0) < (0)) __PYX_ERR(0, 1471, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("accumulate", 0, 1, 4, i); __PYX_ERR(0, 1471, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1471, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1471, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_array = values[0];
    __pyx_v_axis = values[1];
    __pyx_v_dtype = values[2];
    __pyx_v_out = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accumulate", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 1471, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.accumulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_12accumulate(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_array, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12accumulate(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accumulate", 0);

  /* "cupy/_core/_kernel.pyx":1477
 *            :meth:`numpy.ufunc.accumulate`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array.cumsum(axis, dtype, out)
 *         if self.name == 'cupy_multiply':
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_mstate_global->__pyx_n_u_cupy_add, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1477, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1478
 *         """
 *         if self.name == 'cupy_add':
 *             return array.cumsum(axis, dtype, out)             # <<<<<<<<<<<<<<
 *         if self.name == 'cupy_multiply':
 *             return array.cumprod(axis, dtype, out)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_array;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cumsum, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1477
 *            :meth:`numpy.ufunc.accumulate`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array.cumsum(axis, dtype, out)
 *         if self.name == 'cupy_multiply':
*/
  }

  /* "cupy/_core/_kernel.pyx":1479
 *         if self.name == 'cupy_add':
 *             return array.cumsum(axis, dtype, out)
 *         if self.name == 'cupy_multiply':             # <<<<<<<<<<<<<<
 *             return array.cumprod(axis, dtype, out)
 *         raise NotImplementedError(
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_mstate_global->__pyx_n_u_cupy_multiply, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1479, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1480
 *             return array.cumsum(axis, dtype, out)
 *         if self.name == 'cupy_multiply':
 *             return array.cumprod(axis, dtype, out)             # <<<<<<<<<<<<<<
 *         raise NotImplementedError(
 *             f'`{self.name}.accumulate` is not supported yet')
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_array;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_cumprod, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1479
 *         if self.name == 'cupy_add':
 *             return array.cumsum(axis, dtype, out)
 *         if self.name == 'cupy_multiply':             # <<<<<<<<<<<<<<
 *             return array.cumprod(axis, dtype, out)
 *         raise NotImplementedError(
*/
  }

  /* "cupy/_core/_kernel.pyx":1481
 *         if self.name == 'cupy_multiply':
 *             return array.cumprod(axis, dtype, out)
 *         raise NotImplementedError(             # <<<<<<<<<<<<<<
 *             f'`{self.name}.accumulate` is not supported yet')
 * 
*/
  __pyx_t_3 = NULL;

  /* "cupy/_core/_kernel.pyx":1482
 *             return array.cumprod(axis, dtype, out)
 *         raise NotImplementedError(
 *             f'`{self.name}.accumulate` is not supported yet')             # <<<<<<<<<<<<<<
 * 
 *     def reduceat(self, array, indices, axis=0, dtype=None, out=None):
*/
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_self->name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__20;
  __pyx_t_6[1] = __pyx_t_5;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_accumulate_is_not_supported_yet;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 33, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 1481, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1471
 *         raise NotImplementedError(f'`{self.name}.reduce` is not supported yet')
 * 
 *     def accumulate(self, array, axis=0, dtype=None, out=None):             # <<<<<<<<<<<<<<
 *         """Accumulate ``array`` applying ufunc.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.accumulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1484
 *             f'`{self.name}.accumulate` is not supported yet')
 * 
 *     def reduceat(self, array, indices, axis=0, dtype=None, out=None):             # <<<<<<<<<<<<<<
 *         """Reduce ``array`` applying ufunc with indices.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15reduceat(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_14reduceat, "ufunc.reduceat(self, array, indices, axis=0, dtype=None, out=None)\n\nReduce ``array`` applying ufunc with indices.\n\n.. seealso::\n   :meth:`numpy.ufunc.reduceat`");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15reduceat(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_dtype = 0;
  PyObject *__pyx_v_out = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reduceat (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_array,&__pyx_mstate_global->__pyx_n_u_indices,&__pyx_mstate_global->__pyx_n_u_axis,&__pyx_mstate_global->__pyx_n_u_dtype,&__pyx_mstate_global->__pyx_n_u_out,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1484, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "reduceat", 0) < (0)) __PYX_ERR(0, 1484, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("reduceat", 0, 2, 5, i); __PYX_ERR(0, 1484, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1484, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1484, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1484, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_array = values[0];
    __pyx_v_indices = values[1];
    __pyx_v_axis = values[2];
    __pyx_v_dtype = values[3];
    __pyx_v_out = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reduceat", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1484, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.reduceat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_14reduceat(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v_array, __pyx_v_indices, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_14reduceat(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_array, PyObject *__pyx_v_indices, PyObject *__pyx_v_axis, PyObject *__pyx_v_dtype, PyObject *__pyx_v_out) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reduceat", 0);

  /* "cupy/_core/_kernel.pyx":1490
 *            :meth:`numpy.ufunc.reduceat`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array._add_reduceat(indices, axis, dtype, out)
 *         raise NotImplementedError(
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->name, __pyx_mstate_global->__pyx_n_u_cupy_add, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1490, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1491
 *         """
 *         if self.name == 'cupy_add':
 *             return array._add_reduceat(indices, axis, dtype, out)             # <<<<<<<<<<<<<<
 *         raise NotImplementedError(
 *             f'`{self.name}.reduceat` is not supported yet')
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_v_array;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_indices, __pyx_v_axis, __pyx_v_dtype, __pyx_v_out};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_reduceat, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1490
 *            :meth:`numpy.ufunc.reduceat`
 *         """
 *         if self.name == 'cupy_add':             # <<<<<<<<<<<<<<
 *             return array._add_reduceat(indices, axis, dtype, out)
 *         raise NotImplementedError(
*/
  }

  /* "cupy/_core/_kernel.pyx":1492
 *         if self.name == 'cupy_add':
 *             return array._add_reduceat(indices, axis, dtype, out)
 *         raise NotImplementedError(             # <<<<<<<<<<<<<<
 *             f'`{self.name}.reduceat` is not supported yet')
 * 
*/
  __pyx_t_3 = NULL;

  /* "cupy/_core/_kernel.pyx":1493
 *             return array._add_reduceat(indices, axis, dtype, out)
 *         raise NotImplementedError(
 *             f'`{self.name}.reduceat` is not supported yet')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_self->name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u__20;
  __pyx_t_6[1] = __pyx_t_5;
  __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_reduceat_is_not_supported_yet;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 31, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 1492, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1484
 *             f'`{self.name}.accumulate` is not supported yet')
 * 
 *     def reduceat(self, array, indices, axis=0, dtype=None, out=None):             # <<<<<<<<<<<<<<
 *         """Reduce ``array`` applying ufunc with indices.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.reduceat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1160
 * 
 *     cdef:
 *         readonly Py_ssize_t nin             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_3nin_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_3nin_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_3nin___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.nin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1161
 *     cdef:
 *         readonly Py_ssize_t nin
 *         readonly Py_ssize_t nout             # <<<<<<<<<<<<<<
 *         readonly Py_ssize_t nargs
 *         readonly object name
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4nout_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4nout_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_4nout___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.nout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1162
 *         readonly Py_ssize_t nin
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs             # <<<<<<<<<<<<<<
 *         readonly object name
 *         readonly _Ops _ops  # normal routines
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5nargs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5nargs_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_5nargs___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_5nargs___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.nargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1163
 *         readonly Py_ssize_t nout
 *         readonly Py_ssize_t nargs
 *         readonly object name             # <<<<<<<<<<<<<<
 *         readonly _Ops _ops  # normal routines
 *         # routines based on explicitly given output dtype
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4name_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_4name___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4name___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1164
 *         readonly Py_ssize_t nargs
 *         readonly object name
 *         readonly _Ops _ops  # normal routines             # <<<<<<<<<<<<<<
 *         # routines based on explicitly given output dtype
 *         readonly _Ops _out_ops
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_ops_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_ops_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_ops___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_ops);
  __pyx_r = ((PyObject *)__pyx_v_self->_ops);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1166
 *         readonly _Ops _ops  # normal routines
 *         # routines based on explicitly given output dtype
 *         readonly _Ops _out_ops             # <<<<<<<<<<<<<<
 *         readonly object _preamble
 *         readonly object _loop_prep
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8_out_ops_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8_out_ops_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8_out_ops___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8_out_ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_out_ops);
  __pyx_r = ((PyObject *)__pyx_v_self->_out_ops);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1167
 *         # routines based on explicitly given output dtype
 *         readonly _Ops _out_ops
 *         readonly object _preamble             # <<<<<<<<<<<<<<
 *         readonly object _loop_prep
 *         readonly object _default_casting
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_9_preamble_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_9_preamble_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_9_preamble___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_9_preamble___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_preamble);
  __pyx_r = __pyx_v_self->_preamble;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1168
 *         readonly _Ops _out_ops
 *         readonly object _preamble
 *         readonly object _loop_prep             # <<<<<<<<<<<<<<
 *         readonly object _default_casting
 *         readonly object _cutensor_op
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_10_loop_prep_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_10_loop_prep_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_10_loop_prep___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_10_loop_prep___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_loop_prep);
  __pyx_r = __pyx_v_self->_loop_prep;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1169
 *         readonly object _preamble
 *         readonly object _loop_prep
 *         readonly object _default_casting             # <<<<<<<<<<<<<<
 *         readonly object _cutensor_op
 *         readonly int _cutensor_alpha
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_16_default_casting_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_16_default_casting_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_16_default_casting___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_16_default_casting___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_default_casting);
  __pyx_r = __pyx_v_self->_default_casting;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1170
 *         readonly object _loop_prep
 *         readonly object _default_casting
 *         readonly object _cutensor_op             # <<<<<<<<<<<<<<
 *         readonly int _cutensor_alpha
 *         readonly int _cutensor_gamma
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_cutensor_op);
  __pyx_r = __pyx_v_self->_cutensor_op;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1171
 *         readonly object _default_casting
 *         readonly object _cutensor_op
 *         readonly int _cutensor_alpha             # <<<<<<<<<<<<<<
 *         readonly int _cutensor_gamma
 *         readonly str _scatter_op
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc._cutensor_alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1172
 *         readonly object _cutensor_op
 *         readonly int _cutensor_alpha
 *         readonly int _cutensor_gamma             # <<<<<<<<<<<<<<
 *         readonly str _scatter_op
 *         readonly tuple _params
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_gamma); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc._cutensor_gamma.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1173
 *         readonly int _cutensor_alpha
 *         readonly int _cutensor_gamma
 *         readonly str _scatter_op             # <<<<<<<<<<<<<<
 *         readonly tuple _params
 *         readonly tuple _params_with_where
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_11_scatter_op_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_11_scatter_op_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_11_scatter_op___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_11_scatter_op___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_scatter_op);
  __pyx_r = __pyx_v_self->_scatter_op;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1174
 *         readonly int _cutensor_gamma
 *         readonly str _scatter_op
 *         readonly tuple _params             # <<<<<<<<<<<<<<
 *         readonly tuple _params_with_where
 *         readonly dict _routine_cache
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7_params_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7_params_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7_params___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_7_params___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_params);
  __pyx_r = __pyx_v_self->_params;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1175
 *         readonly str _scatter_op
 *         readonly tuple _params
 *         readonly tuple _params_with_where             # <<<<<<<<<<<<<<
 *         readonly dict _routine_cache
 *         readonly dict _kernel_memo
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_18_params_with_where_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_18_params_with_where_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_18_params_with_where___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_18_params_with_where___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_params_with_where);
  __pyx_r = __pyx_v_self->_params_with_where;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1176
 *         readonly tuple _params
 *         readonly tuple _params_with_where
 *         readonly dict _routine_cache             # <<<<<<<<<<<<<<
 *         readonly dict _kernel_memo
 *         readonly object _doc
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_14_routine_cache_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_14_routine_cache_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_14_routine_cache___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_14_routine_cache___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_routine_cache);
  __pyx_r = __pyx_v_self->_routine_cache;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1177
 *         readonly tuple _params_with_where
 *         readonly dict _routine_cache
 *         readonly dict _kernel_memo             # <<<<<<<<<<<<<<
 *         readonly object _doc
 *         public object __doc__
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_kernel_memo);
  __pyx_r = __pyx_v_self->_kernel_memo;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1178
 *         readonly dict _routine_cache
 *         readonly dict _kernel_memo
 *         readonly object _doc             # <<<<<<<<<<<<<<
 *         public object __doc__
 *         readonly object __name__
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_doc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_doc_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_doc___get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_4_doc___get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_doc);
  __pyx_r = __pyx_v_self->_doc;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1179
 *         readonly dict _kernel_memo
 *         readonly object _doc
 *         public object __doc__             # <<<<<<<<<<<<<<
 *         readonly object __name__
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc_____get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->__pyx___doc__);
  __pyx_r = __pyx_v_self->__pyx___doc__;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___2__set__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___2__set__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->__pyx___doc__);
  __Pyx_DECREF(__pyx_v_self->__pyx___doc__);
  __pyx_v_self->__pyx___doc__ = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___4__del__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_5ufunc_7__doc___4__del__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx___doc__);
  __Pyx_DECREF(__pyx_v_self->__pyx___doc__);
  __pyx_v_self->__pyx___doc__ = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1180
 *         readonly object _doc
 *         public object __doc__
 *         readonly object __name__             # <<<<<<<<<<<<<<
 * 
 *     def __init__(
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__name___1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__name___1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__name_____get__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_8__name_____get__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->__pyx___name__);
  __pyx_r = __pyx_v_self->__pyx___name__;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_17__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_16__reduce_cython__, "ufunc.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_17__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_16__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_16__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.__doc__, self.__name__, self._cutensor_alpha, self._cutensor_gamma, self._cutensor_op, self._default_casting, self._doc, self._kernel_memo, self._loop_prep, self._ops, self._out_ops, self._params, self._params_with_where, self._preamble, self._routine_cache, self._scatter_op, self.name, self.nargs, self.nin, self.nout)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->_cutensor_gamma); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_self->nargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_self->nin); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyLong_FromSsize_t(__pyx_v_self->nout); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(20); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->__pyx___doc__);
  __Pyx_GIVEREF(__pyx_v_self->__pyx___doc__);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self->__pyx___doc__) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->__pyx___name__);
  __Pyx_GIVEREF(__pyx_v_self->__pyx___name__);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self->__pyx___name__) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_cutensor_op);
  __Pyx_GIVEREF(__pyx_v_self->_cutensor_op);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_self->_cutensor_op) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_default_casting);
  __Pyx_GIVEREF(__pyx_v_self->_default_casting);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_self->_default_casting) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_doc);
  __Pyx_GIVEREF(__pyx_v_self->_doc);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_v_self->_doc) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_kernel_memo);
  __Pyx_GIVEREF(__pyx_v_self->_kernel_memo);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 7, __pyx_v_self->_kernel_memo) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_loop_prep);
  __Pyx_GIVEREF(__pyx_v_self->_loop_prep);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 8, __pyx_v_self->_loop_prep) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_ops);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_ops);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 9, ((PyObject *)__pyx_v_self->_ops)) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->_out_ops);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->_out_ops);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 10, ((PyObject *)__pyx_v_self->_out_ops)) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_params);
  __Pyx_GIVEREF(__pyx_v_self->_params);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 11, __pyx_v_self->_params) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_params_with_where);
  __Pyx_GIVEREF(__pyx_v_self->_params_with_where);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 12, __pyx_v_self->_params_with_where) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_preamble);
  __Pyx_GIVEREF(__pyx_v_self->_preamble);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 13, __pyx_v_self->_preamble) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_routine_cache);
  __Pyx_GIVEREF(__pyx_v_self->_routine_cache);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 14, __pyx_v_self->_routine_cache) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_scatter_op);
  __Pyx_GIVEREF(__pyx_v_self->_scatter_op);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 15, __pyx_v_self->_scatter_op) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 16, __pyx_v_self->name) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 17, __pyx_t_3) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 18, __pyx_t_4) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 19, __pyx_t_5) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.__doc__, self.__name__, self._cutensor_alpha, self._cutensor_gamma, self._cutensor_op, self._default_casting, self._doc, self._kernel_memo, self._loop_prep, self._ops, self._out_ops, self._params, self._params_with_where, self._preamble, self._routine_cache, self._scatter_op, self.name, self.nargs, self.nin, self.nout)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_6 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v__dict = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "(tree fragment)":7
 *     state = (self.__doc__, self.__name__, self._cutensor_alpha, self._cutensor_gamma, self._cutensor_op, self._default_casting, self._doc, self._kernel_memo, self._loop_prep, self._ops, self._out_ops, self._params, self._params_with_where, self._preamble, self._routine_cache, self._scatter_op, self.name, self.nargs, self.nin, self.nout)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_8 = (__pyx_v__dict != Py_None);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_7) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.__doc__ is not None or self.__name__ is not None or self._cutensor_op is not None or self._default_casting is not None or self._doc is not None or self._kernel_memo is not None or self._loop_prep is not None or self._ops is not None or self._out_ops is not None or self._params is not None or self._params_with_where is not None or self._preamble is not None or self._routine_cache is not None or self._scatter_op is not None or self.name is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.__doc__, self.__name__, self._cutensor_alpha, self._cutensor_gamma, self._cutensor_op, self._default_casting, self._doc, self._kernel_memo, self._loop_prep, self._ops, self._out_ops, self._params, self._params_with_where, self._preamble, self._routine_cache, self._scatter_op, self.name, self.nargs, self.nin, self.nout)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.__doc__ is not None or self.__name__ is not None or self._cutensor_op is not None or self._default_casting is not None or self._doc is not None or self._kernel_memo is not None or self._loop_prep is not None or self._ops is not None or self._out_ops is not None or self._params is not None or self._params_with_where is not None or self._preamble is not None or self._routine_cache is not None or self._scatter_op is not None or self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, None), state
*/
  /*else*/ {
    __pyx_t_8 = (__pyx_v_self->__pyx___doc__ != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->__pyx___name__ != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_cutensor_op != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_default_casting != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_doc != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_kernel_memo != ((PyObject*)Py_None));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_loop_prep != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (((PyObject *)__pyx_v_self->_ops) != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (((PyObject *)__pyx_v_self->_out_ops) != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_params != ((PyObject*)Py_None));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_params_with_where != ((PyObject*)Py_None));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_preamble != Py_None);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_routine_cache != ((PyObject*)Py_None));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->_scatter_op != ((PyObject*)Py_None));
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_self->name != Py_None);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_7;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.__doc__ is not None or self.__name__ is not None or self._cutensor_op is not None or self._default_casting is not None or self._doc is not None or self._kernel_memo is not None or self._loop_prep is not None or self._ops is not None or self._out_ops is not None or self._params is not None or self._params_with_where is not None or self._preamble is not None or self._routine_cache is not None or self._scatter_op is not None or self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.__doc__ is not None or self.__name__ is not None or self._cutensor_op is not None or self._default_casting is not None or self._doc is not None or self._kernel_memo is not None or self._loop_prep is not None or self._ops is not None or self._out_ops is not None or self._params is not None or self._params_with_where is not None or self._preamble is not None or self._routine_cache is not None or self._scatter_op is not None or self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ufunc); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_75976750);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_75976750);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_mstate_global->__pyx_int_75976750) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.__doc__ is not None or self.__name__ is not None or self._cutensor_op is not None or self._default_casting is not None or self._doc is not None or self._kernel_memo is not None or self._loop_prep is not None or self._ops is not None or self._out_ops is not None or self._params is not None or self._params_with_where is not None or self._preamble is not None or self._routine_cache is not None or self._scatter_op is not None or self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, None), state
 *     else:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ufunc__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ufunc); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_75976750);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_75976750);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_mstate_global->__pyx_int_75976750) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ufunc__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_19__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_5ufunc_18__setstate_cython__, "ufunc.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_5ufunc_19__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_5ufunc_18__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_5ufunc_18__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ufunc__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ufunc__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ufunc, (type(self), 0x487502e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ufunc__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel.ufunc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1496
 * 
 * 
 * def _ufunc_doc_signature_formatter(ufunc, name):             # <<<<<<<<<<<<<<
 *     # Based on implementation in NumPy (numpy/_core/_internal.py)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17_ufunc_doc_signature_formatter(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_16_ufunc_doc_signature_formatter, "_ufunc_doc_signature_formatter(ufunc, name)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_17_ufunc_doc_signature_formatter = {"_ufunc_doc_signature_formatter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_17_ufunc_doc_signature_formatter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_16_ufunc_doc_signature_formatter};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_17_ufunc_doc_signature_formatter(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_ufunc = 0;
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ufunc_doc_signature_formatter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ufunc,&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1496, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1496, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_ufunc_doc_signature_formatter", 0) < (0)) __PYX_ERR(0, 1496, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_ufunc_doc_signature_formatter", 1, 2, 2, i); __PYX_ERR(0, 1496, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1496, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1496, __pyx_L3_error)
    }
    __pyx_v_ufunc = values[0];
    __pyx_v_name = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_ufunc_doc_signature_formatter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1496, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._ufunc_doc_signature_formatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_16_ufunc_doc_signature_formatter(__pyx_self, __pyx_v_ufunc, __pyx_v_name);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cupy/_core/_kernel.pyx":1503
 *         in_args = 'x'
 *     else:
 *         in_args = ', '.join(f'x{i+1}' for i in range(ufunc.nin))             # <<<<<<<<<<<<<<
 * 
 *     # output arguments are both keyword or positional
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1503, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_2generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_ufunc_doc_signature_formatter_l, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!gen)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy._core._kernel._ufunc_doc_signature_formatter.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1503, __pyx_L1_error) }
  __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1503, __pyx_L1_error)
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1503, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_n_u_x, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_5generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cupy/_core/_kernel.pyx":1513
 *         out_args = '[, {positional}], / [, out={default}]'.format(
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),             # <<<<<<<<<<<<<<
 *             default=repr((None,)*ufunc.nout)
 *         )
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1513, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_5generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_ufunc_doc_signature_formatter_l, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!gen)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy._core._kernel._ufunc_doc_signature_formatter.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_5generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1513, __pyx_L1_error) }
  __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1513, __pyx_L1_error)
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1513, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u_out_2;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1496
 * 
 * 
 * def _ufunc_doc_signature_formatter(ufunc, name):             # <<<<<<<<<<<<<<
 *     # Based on implementation in NumPy (numpy/_core/_internal.py)
 * 
*/

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_16_ufunc_doc_signature_formatter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ufunc, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_in_args = NULL;
  PyObject *__pyx_v_out_args = NULL;
  PyObject *__pyx_v_kwargs = NULL;
  PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_2generator2 = 0;
  PyObject *__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_5generator3 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ufunc_doc_signature_formatter", 0);

  /* "cupy/_core/_kernel.pyx":1500
 * 
 *     # input arguments are simple
 *     if ufunc.nin == 1:             # <<<<<<<<<<<<<<
 *         in_args = 'x'
 *     else:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":1501
 *     # input arguments are simple
 *     if ufunc.nin == 1:
 *         in_args = 'x'             # <<<<<<<<<<<<<<
 *     else:
 *         in_args = ', '.join(f'x{i+1}' for i in range(ufunc.nin))
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_x);
    __pyx_v_in_args = __pyx_mstate_global->__pyx_n_u_x;

    /* "cupy/_core/_kernel.pyx":1500
 * 
 *     # input arguments are simple
 *     if ufunc.nin == 1:             # <<<<<<<<<<<<<<
 *         in_args = 'x'
 *     else:
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1503
 *         in_args = 'x'
 *     else:
 *         in_args = ', '.join(f'x{i+1}' for i in range(ufunc.nin))             # <<<<<<<<<<<<<<
 * 
 *     # output arguments are both keyword or positional
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_4 = __pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_genexpr(NULL, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_in_args = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1506
 * 
 *     # output arguments are both keyword or positional
 *     if ufunc.nout == 0:             # <<<<<<<<<<<<<<
 *         out_args = ', /, out=()'
 *     elif ufunc.nout == 1:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":1507
 *     # output arguments are both keyword or positional
 *     if ufunc.nout == 0:
 *         out_args = ', /, out=()'             # <<<<<<<<<<<<<<
 *     elif ufunc.nout == 1:
 *         out_args = ', /, out=None'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_out_3);
    __pyx_v_out_args = __pyx_mstate_global->__pyx_kp_u_out_3;

    /* "cupy/_core/_kernel.pyx":1506
 * 
 *     # output arguments are both keyword or positional
 *     if ufunc.nout == 0:             # <<<<<<<<<<<<<<
 *         out_args = ', /, out=()'
 *     elif ufunc.nout == 1:
*/
    goto __pyx_L4;
  }

  /* "cupy/_core/_kernel.pyx":1508
 *     if ufunc.nout == 0:
 *         out_args = ', /, out=()'
 *     elif ufunc.nout == 1:             # <<<<<<<<<<<<<<
 *         out_args = ', /, out=None'
 *     else:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "cupy/_core/_kernel.pyx":1509
 *         out_args = ', /, out=()'
 *     elif ufunc.nout == 1:
 *         out_args = ', /, out=None'             # <<<<<<<<<<<<<<
 *     else:
 *         out_args = '[, {positional}], / [, out={default}]'.format(
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_out_None);
    __pyx_v_out_args = __pyx_mstate_global->__pyx_kp_u_out_None;

    /* "cupy/_core/_kernel.pyx":1508
 *     if ufunc.nout == 0:
 *         out_args = ', /, out=()'
 *     elif ufunc.nout == 1:             # <<<<<<<<<<<<<<
 *         out_args = ', /, out=None'
 *     else:
*/
    goto __pyx_L4;
  }

  /* "cupy/_core/_kernel.pyx":1511
 *         out_args = ', /, out=None'
 *     else:
 *         out_args = '[, {positional}], / [, out={default}]'.format(             # <<<<<<<<<<<<<<
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),
*/
  /*else*/ {
    __pyx_t_1 = __pyx_mstate_global->__pyx_kp_u_positional_out_default;
    __Pyx_INCREF(__pyx_t_1);

    /* "cupy/_core/_kernel.pyx":1513
 *         out_args = '[, {positional}], / [, out={default}]'.format(
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),             # <<<<<<<<<<<<<<
 *             default=repr((None,)*ufunc.nout)
 *         )
*/
    __pyx_t_6 = NULL;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_7 = __pyx_pf_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_3genexpr(NULL, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1512
 *     else:
 *         out_args = '[, {positional}], / [, out={default}]'.format(
 *             positional=', '.join(             # <<<<<<<<<<<<<<
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),
 *             default=repr((None,)*ufunc.nout)
*/
    __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cupy/_core/_kernel.pyx":1514
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),
 *             default=repr((None,)*ufunc.nout)             # <<<<<<<<<<<<<<
 *         )
 * 
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyNumber_Multiply(__pyx_mstate_global->__pyx_tuple[4], __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Repr(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, NULL};
      __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_positional, __pyx_t_7, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1511, __pyx_L1_error)
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_default, __pyx_t_3, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_out_args = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "cupy/_core/_kernel.pyx":1519
 *     # keyword only args depend on whether this is a gufunc
 *     kwargs = (
 *         f", casting='{ufunc._default_casting}'"             # <<<<<<<<<<<<<<
 *         ", dtype=None"
 *     )
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ufunc, __pyx_mstate_global->__pyx_n_u_default_casting_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_casting_2;
  __pyx_t_8[1] = __pyx_t_6;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_dtype_None;
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 13, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_kwargs = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cupy/_core/_kernel.pyx":1524
 * 
 *     # join all the parts together
 *     return r'{name}({in_args}{out_args}, \*{kwargs})'.format(             # <<<<<<<<<<<<<<
 *         name=name,
 *         in_args=in_args,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_name_in_args_out_args_kwargs;
  __Pyx_INCREF(__pyx_t_6);

  /* "cupy/_core/_kernel.pyx":1528
 *         in_args=in_args,
 *         out_args=out_args,
 *         kwargs=kwargs             # <<<<<<<<<<<<<<
 *     )
 * 
*/
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_6, NULL};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_v_name, __pyx_t_3, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_in_args, __pyx_v_in_args, __pyx_t_3, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_out_args, __pyx_v_out_args, __pyx_t_3, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_kwargs, __pyx_v_kwargs, __pyx_t_3, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1496
 * 
 * 
 * def _ufunc_doc_signature_formatter(ufunc, name):             # <<<<<<<<<<<<<<
 *     # Based on implementation in NumPy (numpy/_core/_internal.py)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel._ufunc_doc_signature_formatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_in_args);
  __Pyx_XDECREF(__pyx_v_out_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_2generator2);
  __Pyx_XDECREF(__pyx_gb_4cupy_5_core_7_kernel_30_ufunc_doc_signature_formatter_5generator3);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1534
 * cdef class _Op:
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple out_types, object routine,
 *             object error_func, object resolution_func):
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_3_Op_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_3_Op_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_types = 0;
  PyObject *__pyx_v_out_types = 0;
  PyObject *__pyx_v_routine = 0;
  PyObject *__pyx_v_error_func = 0;
  PyObject *__pyx_v_resolution_func = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_types,&__pyx_mstate_global->__pyx_n_u_out_types,&__pyx_mstate_global->__pyx_n_u_routine,&__pyx_mstate_global->__pyx_n_u_error_func,&__pyx_mstate_global->__pyx_n_u_resolution_func,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1534, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1534, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1534, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1534, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1534, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1534, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1534, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, i); __PYX_ERR(0, 1534, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1534, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1534, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1534, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1534, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1534, __pyx_L3_error)
    }
    __pyx_v_in_types = ((PyObject*)values[0]);
    __pyx_v_out_types = ((PyObject*)values[1]);
    __pyx_v_routine = values[2];
    __pyx_v_error_func = values[3];
    __pyx_v_resolution_func = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1534, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Op.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_types), (&PyTuple_Type), 1, "in_types", 1))) __PYX_ERR(0, 1535, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_types), (&PyTuple_Type), 1, "out_types", 1))) __PYX_ERR(0, 1535, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op___init__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self), __pyx_v_in_types, __pyx_v_out_types, __pyx_v_routine, __pyx_v_error_func, __pyx_v_resolution_func);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_3_Op___init__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_types, PyObject *__pyx_v_out_types, PyObject *__pyx_v_routine, PyObject *__pyx_v_error_func, PyObject *__pyx_v_resolution_func) {
  PyObject *__pyx_9genexpr16__pyx_v_t = NULL;
  PyObject *__pyx_9genexpr17__pyx_v_t = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":1537
 *             self, tuple in_types, tuple out_types, object routine,
 *             object error_func, object resolution_func):
 *         if error_func is None:             # <<<<<<<<<<<<<<
 *             assert routine is not None
 *         else:
*/
  __pyx_t_1 = (__pyx_v_error_func == Py_None);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1538
 *             object error_func, object resolution_func):
 *         if error_func is None:
 *             assert routine is not None             # <<<<<<<<<<<<<<
 *         else:
 *             assert callable(error_func)
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (__pyx_v_routine != Py_None);
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(0, 1538, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1538, __pyx_L1_error)
    #endif

    /* "cupy/_core/_kernel.pyx":1537
 *             self, tuple in_types, tuple out_types, object routine,
 *             object error_func, object resolution_func):
 *         if error_func is None:             # <<<<<<<<<<<<<<
 *             assert routine is not None
 *         else:
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1540
 *             assert routine is not None
 *         else:
 *             assert callable(error_func)             # <<<<<<<<<<<<<<
 *         self.in_types = in_types
 *         self.out_types = out_types
*/
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_error_func); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1540, __pyx_L1_error)
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(0, 1540, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 1540, __pyx_L1_error)
    #endif
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1541
 *         else:
 *             assert callable(error_func)
 *         self.in_types = in_types             # <<<<<<<<<<<<<<
 *         self.out_types = out_types
 *         self.nin = len(in_types)
*/
  __Pyx_INCREF(__pyx_v_in_types);
  __Pyx_GIVEREF(__pyx_v_in_types);
  __Pyx_GOTREF(__pyx_v_self->in_types);
  __Pyx_DECREF(__pyx_v_self->in_types);
  __pyx_v_self->in_types = __pyx_v_in_types;

  /* "cupy/_core/_kernel.pyx":1542
 *             assert callable(error_func)
 *         self.in_types = in_types
 *         self.out_types = out_types             # <<<<<<<<<<<<<<
 *         self.nin = len(in_types)
 *         self.nout = len(out_types)
*/
  __Pyx_INCREF(__pyx_v_out_types);
  __Pyx_GIVEREF(__pyx_v_out_types);
  __Pyx_GOTREF(__pyx_v_self->out_types);
  __Pyx_DECREF(__pyx_v_self->out_types);
  __pyx_v_self->out_types = __pyx_v_out_types;

  /* "cupy/_core/_kernel.pyx":1543
 *         self.in_types = in_types
 *         self.out_types = out_types
 *         self.nin = len(in_types)             # <<<<<<<<<<<<<<
 *         self.nout = len(out_types)
 *         self.routine = routine
*/
  if (unlikely(__pyx_v_in_types == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1543, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_in_types); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1543, __pyx_L1_error)
  __pyx_v_self->nin = __pyx_t_2;

  /* "cupy/_core/_kernel.pyx":1544
 *         self.out_types = out_types
 *         self.nin = len(in_types)
 *         self.nout = len(out_types)             # <<<<<<<<<<<<<<
 *         self.routine = routine
 *         self.error_func = error_func
*/
  if (unlikely(__pyx_v_out_types == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1544, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_v_out_types); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1544, __pyx_L1_error)
  __pyx_v_self->nout = __pyx_t_2;

  /* "cupy/_core/_kernel.pyx":1545
 *         self.nin = len(in_types)
 *         self.nout = len(out_types)
 *         self.routine = routine             # <<<<<<<<<<<<<<
 *         self.error_func = error_func
 * 
*/
  __Pyx_INCREF(__pyx_v_routine);
  __Pyx_GIVEREF(__pyx_v_routine);
  __Pyx_GOTREF(__pyx_v_self->routine);
  __Pyx_DECREF(__pyx_v_self->routine);
  __pyx_v_self->routine = __pyx_v_routine;

  /* "cupy/_core/_kernel.pyx":1546
 *         self.nout = len(out_types)
 *         self.routine = routine
 *         self.error_func = error_func             # <<<<<<<<<<<<<<
 * 
 *         # Resolution func is typically None (non parametric dtypes) but can
*/
  __Pyx_INCREF(__pyx_v_error_func);
  __Pyx_GIVEREF(__pyx_v_error_func);
  __Pyx_GOTREF(__pyx_v_self->error_func);
  __Pyx_DECREF(__pyx_v_self->error_func);
  __pyx_v_self->error_func = __pyx_v_error_func;

  /* "cupy/_core/_kernel.pyx":1556
 *         # skip this. Because (a) it is a bit tricky and (b) it is actually in
 *         # the way for structured. Maybe NumPy will allow this in the future...
 *         self._resolution_func = resolution_func             # <<<<<<<<<<<<<<
 *         self._in_dtypes = tuple([get_dtype(t) for t in in_types])
 *         self._out_dtypes = tuple([get_dtype(t) for t in out_types])
*/
  __Pyx_INCREF(__pyx_v_resolution_func);
  __Pyx_GIVEREF(__pyx_v_resolution_func);
  __Pyx_GOTREF(__pyx_v_self->_resolution_func);
  __Pyx_DECREF(__pyx_v_self->_resolution_func);
  __pyx_v_self->_resolution_func = __pyx_v_resolution_func;

  /* "cupy/_core/_kernel.pyx":1557
 *         # the way for structured. Maybe NumPy will allow this in the future...
 *         self._resolution_func = resolution_func
 *         self._in_dtypes = tuple([get_dtype(t) for t in in_types])             # <<<<<<<<<<<<<<
 *         self._out_dtypes = tuple([get_dtype(t) for t in out_types])
 * 
*/
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1557, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_in_types == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1557, __pyx_L6_error)
    }
    __pyx_t_4 = __pyx_v_in_types; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1557, __pyx_L6_error)
        #endif
        if (__pyx_t_2 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2));
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_2);
      #endif
      ++__pyx_t_2;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1557, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_t, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr16__pyx_v_t, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1557, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1557, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_t); __pyx_9genexpr16__pyx_v_t = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_t); __pyx_9genexpr16__pyx_v_t = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_in_dtypes);
  __Pyx_DECREF(__pyx_v_self->_in_dtypes);
  __pyx_v_self->_in_dtypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cupy/_core/_kernel.pyx":1558
 *         self._resolution_func = resolution_func
 *         self._in_dtypes = tuple([get_dtype(t) for t in in_types])
 *         self._out_dtypes = tuple([get_dtype(t) for t in out_types])             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1558, __pyx_L13_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_out_types == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1558, __pyx_L13_error)
    }
    __pyx_t_3 = __pyx_v_out_types; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1558, __pyx_L13_error)
        #endif
        if (__pyx_t_2 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2));
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_2);
      #endif
      ++__pyx_t_2;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1558, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr17__pyx_v_t, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr17__pyx_v_t, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1558, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1558, __pyx_L13_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_t); __pyx_9genexpr17__pyx_v_t = 0;
    goto __pyx_L17_exit_scope;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_t); __pyx_9genexpr17__pyx_v_t = 0;
    goto __pyx_L1_error;
    __pyx_L17_exit_scope:;
  } /* exit inner scope */
  __pyx_t_3 = PyList_AsTuple(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_out_dtypes);
  __Pyx_DECREF(__pyx_v_self->_out_dtypes);
  __pyx_v_self->_out_dtypes = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1534
 * cdef class _Op:
 * 
 *     def __init__(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple out_types, object routine,
 *             object error_func, object resolution_func):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy._core._kernel._Op.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_t);
  __Pyx_XDECREF(__pyx_9genexpr17__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1560
 *         self._out_dtypes = tuple([get_dtype(t) for t in out_types])
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op _from_type_and_routine_or_error_func(
 *             typ, object routine, object error_func, object resolution_func):
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op__from_type_and_routine_or_error_func(PyObject *__pyx_v_typ, PyObject *__pyx_v_routine, PyObject *__pyx_v_error_func, PyObject *__pyx_v_resolution_func) {
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_v_in_types = NULL;
  PyObject *__pyx_v_out_types = NULL;
  PyObject *__pyx_9genexpr18__pyx_v_t = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_t = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_from_type_and_routine_or_error_func", 0);

  /* "cupy/_core/_kernel.pyx":1564
 *             typ, object routine, object error_func, object resolution_func):
 *         # TODO(niboshi): Write type mapping specification.
 *         if isinstance(typ, str):             # <<<<<<<<<<<<<<
 *             types = typ.split('->')
 *             if len(types) == 1:
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_typ); 
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1565
 *         # TODO(niboshi): Write type mapping specification.
 *         if isinstance(typ, str):
 *             types = typ.split('->')             # <<<<<<<<<<<<<<
 *             if len(types) == 1:
 *                 in_types = out_types = tuple(types)
*/
    __pyx_t_3 = __pyx_v_typ;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__17};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_types = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1566
 *         if isinstance(typ, str):
 *             types = typ.split('->')
 *             if len(types) == 1:             # <<<<<<<<<<<<<<
 *                 in_types = out_types = tuple(types)
 *             else:
*/
    __pyx_t_5 = PyObject_Length(__pyx_v_types); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1566, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_5 == 1);
    if (__pyx_t_1) {

      /* "cupy/_core/_kernel.pyx":1567
 *             types = typ.split('->')
 *             if len(types) == 1:
 *                 in_types = out_types = tuple(types)             # <<<<<<<<<<<<<<
 *             else:
 *                 in_types, out_types = map(tuple, types)
*/
      __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_v_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_in_types = __pyx_t_2;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_out_types = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1566
 *         if isinstance(typ, str):
 *             types = typ.split('->')
 *             if len(types) == 1:             # <<<<<<<<<<<<<<
 *                 in_types = out_types = tuple(types)
 *             else:
*/
      goto __pyx_L4;
    }

    /* "cupy/_core/_kernel.pyx":1569
 *                 in_types = out_types = tuple(types)
 *             else:
 *                 in_types, out_types = map(tuple, types)             # <<<<<<<<<<<<<<
 *         elif isinstance(typ, list):
 *             # E.g. bfloat16 can't be represented well via character.
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)(&PyTuple_Type)), __pyx_v_types};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_map, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1569, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_6);
        } else {
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1569, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1569, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
        }
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L6_unpacking_done;
        __pyx_L5_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1569, __pyx_L1_error)
        __pyx_L6_unpacking_done:;
      }
      __pyx_v_in_types = __pyx_t_3;
      __pyx_t_3 = 0;
      __pyx_v_out_types = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __pyx_L4:;

    /* "cupy/_core/_kernel.pyx":1564
 *             typ, object routine, object error_func, object resolution_func):
 *         # TODO(niboshi): Write type mapping specification.
 *         if isinstance(typ, str):             # <<<<<<<<<<<<<<
 *             types = typ.split('->')
 *             if len(types) == 1:
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1570
 *             else:
 *                 in_types, out_types = map(tuple, types)
 *         elif isinstance(typ, list):             # <<<<<<<<<<<<<<
 *             # E.g. bfloat16 can't be represented well via character.
 *             in_types, out_types = typ
*/
  __pyx_t_1 = PyList_Check(__pyx_v_typ); 
  if (likely(__pyx_t_1)) {

    /* "cupy/_core/_kernel.pyx":1572
 *         elif isinstance(typ, list):
 *             # E.g. bfloat16 can't be represented well via character.
 *             in_types, out_types = typ             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError("Expected string or list for typ identifier.")
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_typ))) || (PyList_CheckExact(__pyx_v_typ))) {
      PyObject* sequence = __pyx_v_typ;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1572, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1572, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_v_typ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
      index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1572, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_in_types = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_out_types = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cupy/_core/_kernel.pyx":1570
 *             else:
 *                 in_types, out_types = map(tuple, types)
 *         elif isinstance(typ, list):             # <<<<<<<<<<<<<<
 *             # E.g. bfloat16 can't be represented well via character.
 *             in_types, out_types = typ
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1574
 *             in_types, out_types = typ
 *         else:
 *             raise TypeError("Expected string or list for typ identifier.")             # <<<<<<<<<<<<<<
 * 
 *         in_types = tuple([get_dtype(t) for t in in_types])
*/
  /*else*/ {
    __pyx_t_2 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Expected_string_or_list_for_typ};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(0, 1574, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1576
 *             raise TypeError("Expected string or list for typ identifier.")
 * 
 *         in_types = tuple([get_dtype(t) for t in in_types])             # <<<<<<<<<<<<<<
 *         out_types = tuple([get_dtype(t) for t in out_types])
 *         return _Op(in_types, out_types, routine, error_func, resolution_func)
*/
  { /* enter inner scope */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1576, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(PyList_CheckExact(__pyx_v_in_types)) || PyTuple_CheckExact(__pyx_v_in_types)) {
      __pyx_t_2 = __pyx_v_in_types; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_in_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1576, __pyx_L11_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1576, __pyx_L11_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1576, __pyx_L11_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5));
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L11_error)
      } else {
        __pyx_t_3 = __pyx_t_9(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1576, __pyx_L11_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_t, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr18__pyx_v_t, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1576, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_t); __pyx_9genexpr18__pyx_v_t = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_t); __pyx_9genexpr18__pyx_v_t = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_in_types, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":1577
 * 
 *         in_types = tuple([get_dtype(t) for t in in_types])
 *         out_types = tuple([get_dtype(t) for t in out_types])             # <<<<<<<<<<<<<<
 *         return _Op(in_types, out_types, routine, error_func, resolution_func)
 * 
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L18_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_v_out_types)) || PyTuple_CheckExact(__pyx_v_out_types)) {
      __pyx_t_6 = __pyx_v_out_types; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_out_types); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1577, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1577, __pyx_L18_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1577, __pyx_L18_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_5;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1577, __pyx_L18_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5));
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_5);
          #endif
          ++__pyx_t_5;
        }
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1577, __pyx_L18_error)
      } else {
        __pyx_t_3 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1577, __pyx_L18_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_t, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_f_4cupy_5_core_6_dtype_get_dtype(__pyx_9genexpr19__pyx_v_t, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1577, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1577, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_t); __pyx_9genexpr19__pyx_v_t = 0;
    goto __pyx_L22_exit_scope;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_t); __pyx_9genexpr19__pyx_v_t = 0;
    goto __pyx_L1_error;
    __pyx_L22_exit_scope:;
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_out_types, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "cupy/_core/_kernel.pyx":1578
 *         in_types = tuple([get_dtype(t) for t in in_types])
 *         out_types = tuple([get_dtype(t) for t in out_types])
 *         return _Op(in_types, out_types, routine, error_func, resolution_func)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_v_in_types, __pyx_v_out_types, __pyx_v_routine, __pyx_v_error_func, __pyx_v_resolution_func};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op, __pyx_callargs+__pyx_t_4, (6-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_6);
  }
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1560
 *         self._out_dtypes = tuple([get_dtype(t) for t in out_types])
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op _from_type_and_routine_or_error_func(
 *             typ, object routine, object error_func, object resolution_func):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cupy._core._kernel._Op._from_type_and_routine_or_error_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_out_types);
  __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_t);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_t);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1580
 *         return _Op(in_types, out_types, routine, error_func, resolution_func)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op from_type_and_routine(typ, routine, resolution_func):
 *         return _Op._from_type_and_routine_or_error_func(
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_routine(PyObject *__pyx_v_typ, PyObject *__pyx_v_routine, PyObject *__pyx_v_resolution_func) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_type_and_routine", 0);

  /* "cupy/_core/_kernel.pyx":1582
 *     @staticmethod
 *     cdef _Op from_type_and_routine(typ, routine, resolution_func):
 *         return _Op._from_type_and_routine_or_error_func(             # <<<<<<<<<<<<<<
 *             typ, routine, None, resolution_func)
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);

  /* "cupy/_core/_kernel.pyx":1583
 *     cdef _Op from_type_and_routine(typ, routine, resolution_func):
 *         return _Op._from_type_and_routine_or_error_func(
 *             typ, routine, None, resolution_func)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_3_Op__from_type_and_routine_or_error_func(__pyx_v_typ, __pyx_v_routine, Py_None, __pyx_v_resolution_func)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1580
 *         return _Op(in_types, out_types, routine, error_func, resolution_func)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op from_type_and_routine(typ, routine, resolution_func):
 *         return _Op._from_type_and_routine_or_error_func(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Op.from_type_and_routine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1585
 *             typ, routine, None, resolution_func)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op from_type_and_error_func(typ, error_func):
 *         return _Op._from_type_and_routine_or_error_func(
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_error_func(PyObject *__pyx_v_typ, PyObject *__pyx_v_error_func) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_type_and_error_func", 0);

  /* "cupy/_core/_kernel.pyx":1587
 *     @staticmethod
 *     cdef _Op from_type_and_error_func(typ, error_func):
 *         return _Op._from_type_and_routine_or_error_func(             # <<<<<<<<<<<<<<
 *             typ, None, error_func, None)
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);

  /* "cupy/_core/_kernel.pyx":1588
 *     cdef _Op from_type_and_error_func(typ, error_func):
 *         return _Op._from_type_and_routine_or_error_func(
 *             typ, None, error_func, None)             # <<<<<<<<<<<<<<
 * 
 *     cdef check_valid(self):
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_3_Op__from_type_and_routine_or_error_func(__pyx_v_typ, Py_None, __pyx_v_error_func, Py_None)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1585
 *             typ, routine, None, resolution_func)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Op from_type_and_error_func(typ, error_func):
 *         return _Op._from_type_and_routine_or_error_func(
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Op.from_type_and_error_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1590
 *             typ, None, error_func, None)
 * 
 *     cdef check_valid(self):             # <<<<<<<<<<<<<<
 *         if self.error_func is not None:
 *             self.error_func()
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel_3_Op_check_valid(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_valid", 0);

  /* "cupy/_core/_kernel.pyx":1591
 * 
 *     cdef check_valid(self):
 *         if self.error_func is not None:             # <<<<<<<<<<<<<<
 *             self.error_func()
 * 
*/
  __pyx_t_1 = (__pyx_v_self->error_func != Py_None);
  if (__pyx_t_1) {

    /* "cupy/_core/_kernel.pyx":1592
 *     cdef check_valid(self):
 *         if self.error_func is not None:
 *             self.error_func()             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple resolve_dtypes(self, list in_args, list out_args):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->error_func);
    __pyx_t_4 = __pyx_v_self->error_func; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1591
 * 
 *     cdef check_valid(self):
 *         if self.error_func is not None:             # <<<<<<<<<<<<<<
 *             self.error_func()
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1590
 *             typ, None, error_func, None)
 * 
 *     cdef check_valid(self):             # <<<<<<<<<<<<<<
 *         if self.error_func is not None:
 *             self.error_func()
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._Op.check_valid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1594
 *             self.error_func()
 * 
 *     cpdef tuple resolve_dtypes(self, list in_args, list out_args):             # <<<<<<<<<<<<<<
 *         # In most cases, this just returns the typical dtypes matching the
 *         # the dtype kind (or DType class, as of now represented by the scalar).
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_3resolve_dtypes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_3_Op_resolve_dtypes(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_args, PyObject *__pyx_v_out_args, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_in_dtypes = NULL;
  PyObject *__pyx_v_out_dtypes = NULL;
  PyObject *__pyx_9genexpr20__pyx_v_arg = NULL;
  PyObject *__pyx_9genexpr21__pyx_v_arg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_dtypes", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_resolve_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_3_Op_3resolve_dtypes)) {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_in_args, __pyx_v_out_args};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1594, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 1594, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":1599
 *         # For parametric DTypes, more complex handling may be necessary and
 *         # can be implemented by providing the resolver function.
 *         if self._resolution_func is None:             # <<<<<<<<<<<<<<
 *             return self._in_dtypes, self._out_dtypes
 * 
*/
  __pyx_t_6 = (__pyx_v_self->_resolution_func == Py_None);
  if (__pyx_t_6) {

    /* "cupy/_core/_kernel.pyx":1600
 *         # can be implemented by providing the resolver function.
 *         if self._resolution_func is None:
 *             return self._in_dtypes, self._out_dtypes             # <<<<<<<<<<<<<<
 * 
 *         in_dtypes = [None if arg is None else arg.dtype for arg in in_args]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_self->_in_dtypes);
    __Pyx_GIVEREF(__pyx_v_self->_in_dtypes);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_in_dtypes) != (0)) __PYX_ERR(0, 1600, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_self->_out_dtypes);
    __Pyx_GIVEREF(__pyx_v_self->_out_dtypes);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_out_dtypes) != (0)) __PYX_ERR(0, 1600, __pyx_L1_error);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1599
 *         # For parametric DTypes, more complex handling may be necessary and
 *         # can be implemented by providing the resolver function.
 *         if self._resolution_func is None:             # <<<<<<<<<<<<<<
 *             return self._in_dtypes, self._out_dtypes
 * 
*/
  }

  /* "cupy/_core/_kernel.pyx":1602
 *             return self._in_dtypes, self._out_dtypes
 * 
 *         in_dtypes = [None if arg is None else arg.dtype for arg in in_args]             # <<<<<<<<<<<<<<
 *         out_dtypes = [None if arg is None else arg.dtype for arg in out_args]
 *         return self._resolution_func(self, tuple(in_dtypes), tuple(out_dtypes))
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_in_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1602, __pyx_L6_error)
    }
    __pyx_t_2 = __pyx_v_in_args; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1602, __pyx_L6_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1602, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_arg, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = (__pyx_9genexpr20__pyx_v_arg == Py_None);
      if (__pyx_t_6) {
        __Pyx_INCREF(Py_None);
        __pyx_t_4 = Py_None;
      } else {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr20__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1602, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_arg); __pyx_9genexpr20__pyx_v_arg = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_arg); __pyx_9genexpr20__pyx_v_arg = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_v_in_dtypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1603
 * 
 *         in_dtypes = [None if arg is None else arg.dtype for arg in in_args]
 *         out_dtypes = [None if arg is None else arg.dtype for arg in out_args]             # <<<<<<<<<<<<<<
 *         return self._resolution_func(self, tuple(in_dtypes), tuple(out_dtypes))
 * 
*/
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1603, __pyx_L13_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__pyx_v_out_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1603, __pyx_L13_error)
    }
    __pyx_t_2 = __pyx_v_out_args; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1603, __pyx_L13_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1603, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr21__pyx_v_arg, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = (__pyx_9genexpr21__pyx_v_arg == Py_None);
      if (__pyx_t_6) {
        __Pyx_INCREF(Py_None);
        __pyx_t_4 = Py_None;
      } else {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr21__pyx_v_arg, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1603, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1603, __pyx_L13_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_arg); __pyx_9genexpr21__pyx_v_arg = 0;
    goto __pyx_L17_exit_scope;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_arg); __pyx_9genexpr21__pyx_v_arg = 0;
    goto __pyx_L1_error;
    __pyx_L17_exit_scope:;
  } /* exit inner scope */
  __pyx_v_out_dtypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1604
 *         in_dtypes = [None if arg is None else arg.dtype for arg in in_args]
 *         out_dtypes = [None if arg is None else arg.dtype for arg in out_args]
 *         return self._resolution_func(self, tuple(in_dtypes), tuple(out_dtypes))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_v_self->_resolution_func);
  __pyx_t_4 = __pyx_v_self->_resolution_func; 
  __pyx_t_3 = PyList_AsTuple(__pyx_v_in_dtypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyList_AsTuple(__pyx_v_out_dtypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 1604, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1594
 *             self.error_func()
 * 
 *     cpdef tuple resolve_dtypes(self, list in_args, list out_args):             # <<<<<<<<<<<<<<
 *         # In most cases, this just returns the typical dtypes matching the
 *         # the dtype kind (or DType class, as of now represented by the scalar).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._Op.resolve_dtypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_in_dtypes);
  __Pyx_XDECREF(__pyx_v_out_dtypes);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_arg);
  __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_arg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_3resolve_dtypes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_3_Op_2resolve_dtypes, "_Op.resolve_dtypes(self, list in_args, list out_args) -> tuple");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_3resolve_dtypes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_in_args = 0;
  PyObject *__pyx_v_out_args = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resolve_dtypes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_args,&__pyx_mstate_global->__pyx_n_u_out_args,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1594, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1594, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1594, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resolve_dtypes", 0) < (0)) __PYX_ERR(0, 1594, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resolve_dtypes", 1, 2, 2, i); __PYX_ERR(0, 1594, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1594, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1594, __pyx_L3_error)
    }
    __pyx_v_in_args = ((PyObject*)values[0]);
    __pyx_v_out_args = ((PyObject*)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("resolve_dtypes", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1594, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Op.resolve_dtypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_args), (&PyList_Type), 1, "in_args", 1))) __PYX_ERR(0, 1594, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_args), (&PyList_Type), 1, "out_args", 1))) __PYX_ERR(0, 1594, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_2resolve_dtypes(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self), __pyx_v_in_args, __pyx_v_out_args);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_2resolve_dtypes(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v_in_args, PyObject *__pyx_v_out_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resolve_dtypes", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel_3_Op_resolve_dtypes(__pyx_v_self, __pyx_v_in_args, __pyx_v_out_args, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Op.resolve_dtypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1606
 *         return self._resolution_func(self, tuple(in_dtypes), tuple(out_dtypes))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         # Just for debugging purposes.
 *         return (f"cupy._core._kernel._Op({self.in_types}, {self.out_types}, "
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_5__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_4__repr__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_4__repr__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5[9];
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cupy/_core/_kernel.pyx":1608
 *     def __repr__(self):
 *         # Just for debugging purposes.
 *         return (f"cupy._core._kernel._Op({self.in_types}, {self.out_types}, "             # <<<<<<<<<<<<<<
 *                 f"routine={self.routine}, error_func={self.error_func})")
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_self->in_types, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_self->out_types, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cupy/_core/_kernel.pyx":1609
 *         # Just for debugging purposes.
 *         return (f"cupy._core._kernel._Op({self.in_types}, {self.out_types}, "
 *                 f"routine={self.routine}, error_func={self.error_func})")             # <<<<<<<<<<<<<<
 * 
 * cdef class _Ops:
*/
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_self->routine, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_self->error_func, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_cupy__core__kernel__Op;
  __pyx_t_5[1] = __pyx_t_1;
  __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_5[3] = __pyx_t_2;
  __pyx_t_5[4] = __pyx_mstate_global->__pyx_kp_u_routine_2;
  __pyx_t_5[5] = __pyx_t_3;
  __pyx_t_5[6] = __pyx_mstate_global->__pyx_kp_u_error_func_2;
  __pyx_t_5[7] = __pyx_t_4;
  __pyx_t_5[8] = __pyx_mstate_global->__pyx_kp_u__11;

  /* "cupy/_core/_kernel.pyx":1608
 *     def __repr__(self):
 *         # Just for debugging purposes.
 *         return (f"cupy._core._kernel._Op({self.in_types}, {self.out_types}, "             # <<<<<<<<<<<<<<
 *                 f"routine={self.routine}, error_func={self.error_func})")
 * 
*/
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 9, 23 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1606
 *         return self._resolution_func(self, tuple(in_dtypes), tuple(out_dtypes))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         # Just for debugging purposes.
 *         return (f"cupy._core._kernel._Op({self.in_types}, {self.out_types}, "
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy._core._kernel._Op.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":96
 * 
 *     cdef:
 *         readonly tuple in_types             # <<<<<<<<<<<<<<
 *         readonly tuple out_types
 *         readonly int nin
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_8in_types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_8in_types_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_8in_types___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_8in_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->in_types);
  __pyx_r = __pyx_v_self->in_types;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":97
 *     cdef:
 *         readonly tuple in_types
 *         readonly tuple out_types             # <<<<<<<<<<<<<<
 *         readonly int nin
 *         readonly int nout
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_9out_types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_9out_types_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_9out_types___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_9out_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->out_types);
  __pyx_r = __pyx_v_self->out_types;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":98
 *         readonly tuple in_types
 *         readonly tuple out_types
 *         readonly int nin             # <<<<<<<<<<<<<<
 *         readonly int nout
 *         readonly object routine
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_3nin_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_3nin_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_3nin___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Op.nin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":99
 *         readonly tuple out_types
 *         readonly int nin
 *         readonly int nout             # <<<<<<<<<<<<<<
 *         readonly object routine
 *         # If the type combination specified by in_types and out_types is
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_4nout_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_4nout_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_4nout___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nout); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Op.nout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":100
 *         readonly int nin
 *         readonly int nout
 *         readonly object routine             # <<<<<<<<<<<<<<
 *         # If the type combination specified by in_types and out_types is
 *         # disallowed, error_func must be set instead of routine.
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_7routine_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_7routine_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_7routine___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_7routine___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->routine);
  __pyx_r = __pyx_v_self->routine;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":104
 *         # disallowed, error_func must be set instead of routine.
 *         # It's called by check_valid() method.
 *         readonly object error_func             # <<<<<<<<<<<<<<
 *         readonly object _resolution_func
 *         readonly tuple _in_dtypes
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_10error_func_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_10error_func_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_10error_func___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_10error_func___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->error_func);
  __pyx_r = __pyx_v_self->error_func;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":105
 *         # It's called by check_valid() method.
 *         readonly object error_func
 *         readonly object _resolution_func             # <<<<<<<<<<<<<<
 *         readonly tuple _in_dtypes
 *         readonly tuple _out_dtypes
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_16_resolution_func_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_16_resolution_func_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_16_resolution_func___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_16_resolution_func___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_resolution_func);
  __pyx_r = __pyx_v_self->_resolution_func;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":106
 *         readonly object error_func
 *         readonly object _resolution_func
 *         readonly tuple _in_dtypes             # <<<<<<<<<<<<<<
 *         readonly tuple _out_dtypes
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_10_in_dtypes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_10_in_dtypes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_10_in_dtypes___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_10_in_dtypes___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_in_dtypes);
  __pyx_r = __pyx_v_self->_in_dtypes;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":107
 *         readonly object _resolution_func
 *         readonly tuple _in_dtypes
 *         readonly tuple _out_dtypes             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_11_out_dtypes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_11_out_dtypes_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_11_out_dtypes___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_11_out_dtypes___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_out_dtypes);
  __pyx_r = __pyx_v_self->_out_dtypes;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_3_Op_6__reduce_cython__, "_Op.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_7__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_6__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_6__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self._in_dtypes, self._out_dtypes, self._resolution_func, self.error_func, self.in_types, self.nin, self.nout, self.out_types, self.routine)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->nout); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(9); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->_in_dtypes);
  __Pyx_GIVEREF(__pyx_v_self->_in_dtypes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->_in_dtypes) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_out_dtypes);
  __Pyx_GIVEREF(__pyx_v_self->_out_dtypes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->_out_dtypes) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->_resolution_func);
  __Pyx_GIVEREF(__pyx_v_self->_resolution_func);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->_resolution_func) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->error_func);
  __Pyx_GIVEREF(__pyx_v_self->error_func);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->error_func) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->in_types);
  __Pyx_GIVEREF(__pyx_v_self->in_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_self->in_types) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->out_types);
  __Pyx_GIVEREF(__pyx_v_self->out_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_v_self->out_types) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->routine);
  __Pyx_GIVEREF(__pyx_v_self->routine);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 8, __pyx_v_self->routine) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self._in_dtypes, self._out_dtypes, self._resolution_func, self.error_func, self.in_types, self.nin, self.nout, self.out_types, self.routine)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self._in_dtypes, self._out_dtypes, self._resolution_func, self.error_func, self.in_types, self.nin, self.nout, self.out_types, self.routine)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self._in_dtypes is not None or self._out_dtypes is not None or self._resolution_func is not None or self.error_func is not None or self.in_types is not None or self.out_types is not None or self.routine is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self._in_dtypes, self._out_dtypes, self._resolution_func, self.error_func, self.in_types, self.nin, self.nout, self.out_types, self.routine)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self._in_dtypes is not None or self._out_dtypes is not None or self._resolution_func is not None or self.error_func is not None or self.in_types is not None or self.out_types is not None or self.routine is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, None), state
*/
  /*else*/ {
    __pyx_t_5 = (__pyx_v_self->_in_dtypes != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->_out_dtypes != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->_resolution_func != Py_None);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->error_func != Py_None);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->in_types != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->out_types != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->routine != Py_None);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_4;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._in_dtypes is not None or self._out_dtypes is not None or self._resolution_func is not None or self.error_func is not None or self.in_types is not None or self.out_types is not None or self.routine is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self._in_dtypes is not None or self._out_dtypes is not None or self._resolution_func is not None or self.error_func is not None or self.in_types is not None or self.out_types is not None or self.routine is not None
 *     if use_setstate:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Op); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_264656072);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_264656072);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_264656072) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self._in_dtypes is not None or self._out_dtypes is not None or self._resolution_func is not None or self.error_func is not None or self.in_types is not None or self.out_types is not None or self.routine is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, None), state
 *     else:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__Op__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Op); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_264656072);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_264656072);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_264656072) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._Op.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__Op__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_3_Op_8__setstate_cython__, "_Op.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_3_Op_9__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Op.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_3_Op_8__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_3_Op_8__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__Op__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Op__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__Op, (type(self), 0xfc654c8, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__Op__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._Op.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1613
 * cdef class _Ops:
 * 
 *     def __init__(self, tuple ops, promote_types=None):             # <<<<<<<<<<<<<<
 *         assert len(ops) > 0
 *         nin = ops[0].nin
*/

/* Python wrapper */
static int __pyx_pw_4cupy_5_core_7_kernel_4_Ops_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_5_core_7_kernel_4_Ops_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ops = 0;
  PyObject *__pyx_v_promote_types = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ops,&__pyx_mstate_global->__pyx_n_u_promote_types,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1613, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1613, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1613, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1613, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, i); __PYX_ERR(0, 1613, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1613, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1613, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_ops = ((PyObject*)values[0]);
    __pyx_v_promote_types = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1613, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Ops.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ops), (&PyTuple_Type), 1, "ops", 1))) __PYX_ERR(0, 1613, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops___init__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self), __pyx_v_ops, __pyx_v_promote_types);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4cupy_5_core_7_kernel_4_Ops___init__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_ops, PyObject *__pyx_v_promote_types) {
  PyObject *__pyx_v_nin = NULL;
  PyObject *__pyx_v_nout = NULL;
  PyObject *__pyx_v_op = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8[3];
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/_core/_kernel.pyx":1614
 * 
 *     def __init__(self, tuple ops, promote_types=None):
 *         assert len(ops) > 0             # <<<<<<<<<<<<<<
 *         nin = ops[0].nin
 *         nout = ops[0].nout
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(__pyx_v_ops == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 1614, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_ops); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1614, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_1 > 0);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(0, 1614, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1614, __pyx_L1_error)
  #endif

  /* "cupy/_core/_kernel.pyx":1615
 *     def __init__(self, tuple ops, promote_types=None):
 *         assert len(ops) > 0
 *         nin = ops[0].nin             # <<<<<<<<<<<<<<
 *         nout = ops[0].nout
 *         for op in ops:
*/
  if (unlikely(__pyx_v_ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1615, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_ops, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_nin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nin = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cupy/_core/_kernel.pyx":1616
 *         assert len(ops) > 0
 *         nin = ops[0].nin
 *         nout = ops[0].nout             # <<<<<<<<<<<<<<
 *         for op in ops:
 *             if op.nin != nin or op.nout != nout:
*/
  if (unlikely(__pyx_v_ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1616, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_ops, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_nout = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1617
 *         nin = ops[0].nin
 *         nout = ops[0].nout
 *         for op in ops:             # <<<<<<<<<<<<<<
 *             if op.nin != nin or op.nout != nout:
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
*/
  if (unlikely(__pyx_v_ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1617, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_ops; __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1617, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1));
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_op, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":1618
 *         nout = ops[0].nout
 *         for op in ops:
 *             if op.nin != nin or op.nout != nout:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
 *         self.ops = ops
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_op, __pyx_mstate_global->__pyx_n_u_nin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_nin, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_6) {
    } else {
      __pyx_t_2 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_op, __pyx_mstate_global->__pyx_n_u_nout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_nout, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1618, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "cupy/_core/_kernel.pyx":1619
 *         for op in ops:
 *             if op.nin != nin or op.nout != nout:
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")             # <<<<<<<<<<<<<<
 *         self.ops = ops
 *         self.nin = nin
*/
      __pyx_t_5 = NULL;
      __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_op, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_invalid_op;
      __pyx_t_8[1] = __pyx_t_7;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_wrong_nin_or_nout;
      __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 20, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_9};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 1619, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1618
 *         nout = ops[0].nout
 *         for op in ops:
 *             if op.nin != nin or op.nout != nout:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
 *         self.ops = ops
*/
    }

    /* "cupy/_core/_kernel.pyx":1617
 *         nin = ops[0].nin
 *         nout = ops[0].nout
 *         for op in ops:             # <<<<<<<<<<<<<<
 *             if op.nin != nin or op.nout != nout:
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/_core/_kernel.pyx":1620
 *             if op.nin != nin or op.nout != nout:
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
 *         self.ops = ops             # <<<<<<<<<<<<<<
 *         self.nin = nin
 *         self.nout = nout
*/
  __Pyx_INCREF(__pyx_v_ops);
  __Pyx_GIVEREF(__pyx_v_ops);
  __Pyx_GOTREF(__pyx_v_self->ops);
  __Pyx_DECREF(__pyx_v_self->ops);
  __pyx_v_self->ops = __pyx_v_ops;

  /* "cupy/_core/_kernel.pyx":1621
 *                 raise ValueError(f"invalid op {op}, wrong nin or nout.")
 *         self.ops = ops
 *         self.nin = nin             # <<<<<<<<<<<<<<
 *         self.nout = nout
 *         self.promote_types = promote_types
*/
  __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_nin); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1621, __pyx_L1_error)
  __pyx_v_self->nin = __pyx_t_11;

  /* "cupy/_core/_kernel.pyx":1622
 *         self.ops = ops
 *         self.nin = nin
 *         self.nout = nout             # <<<<<<<<<<<<<<
 *         self.promote_types = promote_types
 * 
*/
  __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_nout); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L1_error)
  __pyx_v_self->nout = __pyx_t_11;

  /* "cupy/_core/_kernel.pyx":1623
 *         self.nin = nin
 *         self.nout = nout
 *         self.promote_types = promote_types             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_INCREF(__pyx_v_promote_types);
  __Pyx_GIVEREF(__pyx_v_promote_types);
  __Pyx_GOTREF(__pyx_v_self->promote_types);
  __Pyx_DECREF(__pyx_v_self->promote_types);
  __pyx_v_self->promote_types = __pyx_v_promote_types;

  /* "cupy/_core/_kernel.pyx":1613
 * cdef class _Ops:
 * 
 *     def __init__(self, tuple ops, promote_types=None):             # <<<<<<<<<<<<<<
 *         assert len(ops) > 0
 *         nin = ops[0].nin
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nin);
  __Pyx_XDECREF(__pyx_v_nout);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1625
 *         self.promote_types = promote_types
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):
 *         ops_ = []
*/

static struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_f_4cupy_5_core_7_kernel_4_Ops_from_tuples(PyObject *__pyx_v_ops, PyObject *__pyx_v_routine, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples *__pyx_optional_args) {

  /* "cupy/_core/_kernel.pyx":1626
 * 
 *     @staticmethod
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):             # <<<<<<<<<<<<<<
 *         ops_ = []
 *         for t in ops:
*/
  PyObject *__pyx_v_promote_types = ((PyObject *)Py_None);
  PyObject *__pyx_v_ops_ = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_resolution_func = NULL;
  PyObject *__pyx_v_typ = NULL;
  PyObject *__pyx_v_rt = NULL;
  PyObject *__pyx_v_res_func = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_r1 = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_r2 = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16[4];
  int __pyx_t_17;
  PyObject *__pyx_t_18[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_tuples", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_promote_types = __pyx_optional_args->promote_types;
    }
  }

  /* "cupy/_core/_kernel.pyx":1627
 *     @staticmethod
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):
 *         ops_ = []             # <<<<<<<<<<<<<<
 *         for t in ops:
 *             resolution_func = None
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ops_ = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1628
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):
 *         ops_ = []
 *         for t in ops:             # <<<<<<<<<<<<<<
 *             resolution_func = None
 *             if isinstance(t, tuple):
*/
  if (likely(PyList_CheckExact(__pyx_v_ops)) || PyTuple_CheckExact(__pyx_v_ops)) {
    __pyx_t_1 = __pyx_v_ops; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_ops); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1628, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1628, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1628, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1628, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":1629
 *         ops_ = []
 *         for t in ops:
 *             resolution_func = None             # <<<<<<<<<<<<<<
 *             if isinstance(t, tuple):
 *                 typ, rt, *res_func = t
*/
    __Pyx_INCREF(Py_None);
    __Pyx_XDECREF_SET(__pyx_v_resolution_func, Py_None);

    /* "cupy/_core/_kernel.pyx":1630
 *         for t in ops:
 *             resolution_func = None
 *             if isinstance(t, tuple):             # <<<<<<<<<<<<<<
 *                 typ, rt, *res_func = t
 *                 if res_func:
*/
    __pyx_t_5 = PyTuple_Check(__pyx_v_t); 
    if (__pyx_t_5) {

      /* "cupy/_core/_kernel.pyx":1631
 *             resolution_func = None
 *             if isinstance(t, tuple):
 *                 typ, rt, *res_func = t             # <<<<<<<<<<<<<<
 *                 if res_func:
 *                     resolution_func, = res_func
*/
      {
        Py_ssize_t index = -1;
        PyObject** temps[3] = {&__pyx_t_4,&__pyx_t_6};
        __pyx_t_7 = PyObject_GetIter(__pyx_v_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1631, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        for (index=0; index < 2; index++) {
          PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1631, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __pyx_t_9 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_typ, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_rt, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_res_func, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "cupy/_core/_kernel.pyx":1632
 *             if isinstance(t, tuple):
 *                 typ, rt, *res_func = t
 *                 if res_func:             # <<<<<<<<<<<<<<
 *                     resolution_func, = res_func
 * 
*/
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_res_func);
        if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 1632, __pyx_L1_error)
        __pyx_t_5 = (__pyx_temp != 0);
      }

      if (__pyx_t_5) {

        /* "cupy/_core/_kernel.pyx":1633
 *                 typ, rt, *res_func = t
 *                 if res_func:
 *                     resolution_func, = res_func             # <<<<<<<<<<<<<<
 * 
 *                 if rt is None:
*/
        if (1) {
          PyObject* sequence = __pyx_v_res_func;
          Py_ssize_t size = __Pyx_PyList_GET_SIZE(sequence);
          if (unlikely(size != 1)) {
            if (size > 1) __Pyx_RaiseTooManyValuesError(1);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1633, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1633, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
          #else
          __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1633, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
        __Pyx_DECREF_SET(__pyx_v_resolution_func, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "cupy/_core/_kernel.pyx":1632
 *             if isinstance(t, tuple):
 *                 typ, rt, *res_func = t
 *                 if res_func:             # <<<<<<<<<<<<<<
 *                     resolution_func, = res_func
 * 
*/
      }

      /* "cupy/_core/_kernel.pyx":1635
 *                     resolution_func, = res_func
 * 
 *                 if rt is None:             # <<<<<<<<<<<<<<
 *                     rt = routine
 *                 elif isinstance(rt, tuple):
*/
      __pyx_t_5 = (__pyx_v_rt == Py_None);
      if (__pyx_t_5) {

        /* "cupy/_core/_kernel.pyx":1636
 * 
 *                 if rt is None:
 *                     rt = routine             # <<<<<<<<<<<<<<
 *                 elif isinstance(rt, tuple):
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
*/
        __Pyx_INCREF(__pyx_v_routine);
        __Pyx_DECREF_SET(__pyx_v_rt, __pyx_v_routine);

        /* "cupy/_core/_kernel.pyx":1635
 *                     resolution_func, = res_func
 * 
 *                 if rt is None:             # <<<<<<<<<<<<<<
 *                     rt = routine
 *                 elif isinstance(rt, tuple):
*/
        goto __pyx_L9;
      }

      /* "cupy/_core/_kernel.pyx":1637
 *                 if rt is None:
 *                     rt = routine
 *                 elif isinstance(rt, tuple):             # <<<<<<<<<<<<<<
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):
*/
      __pyx_t_5 = PyTuple_Check(__pyx_v_rt); 
      if (__pyx_t_5) {

        /* "cupy/_core/_kernel.pyx":1638
 *                     rt = routine
 *                 elif isinstance(rt, tuple):
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])             # <<<<<<<<<<<<<<
 *                 elif not isinstance(rt, (str, list)):
 *                     if not callable(rt):
*/
        { /* enter inner scope */
          __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1638, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = NULL;
          __pyx_t_10 = 1;
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_rt, __pyx_v_routine};
            __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_10, (3-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1638, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_6);
          }
          if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
            __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4);
            __pyx_t_11 = 0;
            __pyx_t_12 = NULL;
          } else {
            __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1638, __pyx_L12_error)
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          for (;;) {
            if (likely(!__pyx_t_12)) {
              if (likely(PyList_CheckExact(__pyx_t_4))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1638, __pyx_L12_error)
                  #endif
                  if (__pyx_t_11 >= __pyx_temp) break;
                }
                __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
                ++__pyx_t_11;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1638, __pyx_L12_error)
                  #endif
                  if (__pyx_t_11 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11));
                #else
                __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_11);
                #endif
                ++__pyx_t_11;
              }
              if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1638, __pyx_L12_error)
            } else {
              __pyx_t_6 = __pyx_t_12(__pyx_t_4);
              if (unlikely(!__pyx_t_6)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1638, __pyx_L12_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_6);
            if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
              PyObject* sequence = __pyx_t_6;
              Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
              if (unlikely(size != 2)) {
                if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                __PYX_ERR(0, 1638, __pyx_L12_error)
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
                __Pyx_INCREF(__pyx_t_7);
                __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
                __Pyx_INCREF(__pyx_t_13);
              } else {
                __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L12_error)
                __Pyx_XGOTREF(__pyx_t_7);
                __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
                if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1638, __pyx_L12_error)
                __Pyx_XGOTREF(__pyx_t_13);
              }
              #else
              __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1638, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_13);
              #endif
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else {
              Py_ssize_t index = -1;
              __pyx_t_14 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1638, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
              __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14);
              index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_7);
              index = 1; __pyx_t_13 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L15_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_13);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < (0)) __PYX_ERR(0, 1638, __pyx_L12_error)
              __pyx_t_8 = NULL;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              goto __pyx_L16_unpacking_done;
              __pyx_L15_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __pyx_t_8 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              __PYX_ERR(0, 1638, __pyx_L12_error)
              __pyx_L16_unpacking_done:;
            }
            __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_r1, __pyx_t_7);
            __pyx_t_7 = 0;
            __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_r2, __pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_9genexpr22__pyx_v_r1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1638, __pyx_L12_error)
            if (!__pyx_t_5) {
            } else {
              __Pyx_INCREF(__pyx_9genexpr22__pyx_v_r1);
              __pyx_t_6 = __pyx_9genexpr22__pyx_v_r1;
              goto __pyx_L17_bool_binop_done;
            }
            __Pyx_INCREF(__pyx_9genexpr22__pyx_v_r2);
            __pyx_t_6 = __pyx_9genexpr22__pyx_v_r2;
            __pyx_L17_bool_binop_done:;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1638, __pyx_L12_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r1); __pyx_9genexpr22__pyx_v_r1 = 0;
          __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r2); __pyx_9genexpr22__pyx_v_r2 = 0;
          goto __pyx_L20_exit_scope;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r1); __pyx_9genexpr22__pyx_v_r1 = 0;
          __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r2); __pyx_9genexpr22__pyx_v_r2 = 0;
          goto __pyx_L1_error;
          __pyx_L20_exit_scope:;
        } /* exit inner scope */
        __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF_SET(__pyx_v_rt, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "cupy/_core/_kernel.pyx":1637
 *                 if rt is None:
 *                     rt = routine
 *                 elif isinstance(rt, tuple):             # <<<<<<<<<<<<<<
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):
*/
        goto __pyx_L9;
      }

      /* "cupy/_core/_kernel.pyx":1639
 *                 elif isinstance(rt, tuple):
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):             # <<<<<<<<<<<<<<
 *                     if not callable(rt):
 *                         raise ValueError(
*/
      __pyx_t_15 = PyUnicode_Check(__pyx_v_rt); 
      if (!__pyx_t_15) {
      } else {
        __pyx_t_5 = __pyx_t_15;
        goto __pyx_L21_bool_binop_done;
      }
      __pyx_t_15 = PyList_Check(__pyx_v_rt); 
      __pyx_t_5 = __pyx_t_15;
      __pyx_L21_bool_binop_done:;
      __pyx_t_15 = (!__pyx_t_5);
      if (__pyx_t_15) {

        /* "cupy/_core/_kernel.pyx":1640
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):
 *                     if not callable(rt):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"invalid op {t}, expected callable {rt}")
*/
        __pyx_t_15 = __Pyx_PyCallable_Check(__pyx_v_rt); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1640, __pyx_L1_error)
        __pyx_t_5 = (!__pyx_t_15);
        if (unlikely(__pyx_t_5)) {

          /* "cupy/_core/_kernel.pyx":1641
 *                 elif not isinstance(rt, (str, list)):
 *                     if not callable(rt):
 *                         raise ValueError(             # <<<<<<<<<<<<<<
 *                             f"invalid op {t}, expected callable {rt}")
 *                     assert callable(rt)
*/
          __pyx_t_9 = NULL;

          /* "cupy/_core/_kernel.pyx":1642
 *                     if not callable(rt):
 *                         raise ValueError(
 *                             f"invalid op {t}, expected callable {rt}")             # <<<<<<<<<<<<<<
 *                     assert callable(rt)
 *                     assert resolution_func is None  # can't error and resolve
*/
          __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_t, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1642, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_rt, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1642, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_invalid_op;
          __pyx_t_16[1] = __pyx_t_6;
          __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u_expected_callable;
          __pyx_t_16[3] = __pyx_t_13;
          __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13));
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1642, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_10 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7};
            __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1641, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __Pyx_Raise(__pyx_t_4, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __PYX_ERR(0, 1641, __pyx_L1_error)

          /* "cupy/_core/_kernel.pyx":1640
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):
 *                     if not callable(rt):             # <<<<<<<<<<<<<<
 *                         raise ValueError(
 *                             f"invalid op {t}, expected callable {rt}")
*/
        }

        /* "cupy/_core/_kernel.pyx":1643
 *                         raise ValueError(
 *                             f"invalid op {t}, expected callable {rt}")
 *                     assert callable(rt)             # <<<<<<<<<<<<<<
 *                     assert resolution_func is None  # can't error and resolve
 *                     ops_.append(_Op.from_type_and_error_func(typ, rt))
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_5 = __Pyx_PyCallable_Check(__pyx_v_rt); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1643, __pyx_L1_error)
          if (unlikely(!__pyx_t_5)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
            __PYX_ERR(0, 1643, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(0, 1643, __pyx_L1_error)
        #endif

        /* "cupy/_core/_kernel.pyx":1644
 *                             f"invalid op {t}, expected callable {rt}")
 *                     assert callable(rt)
 *                     assert resolution_func is None  # can't error and resolve             # <<<<<<<<<<<<<<
 *                     ops_.append(_Op.from_type_and_error_func(typ, rt))
 *                     continue
*/
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(__pyx_assertions_enabled())) {
          __pyx_t_5 = (__pyx_v_resolution_func == Py_None);
          if (unlikely(!__pyx_t_5)) {
            __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
            __PYX_ERR(0, 1644, __pyx_L1_error)
          }
        }
        #else
        if ((1)); else __PYX_ERR(0, 1644, __pyx_L1_error)
        #endif

        /* "cupy/_core/_kernel.pyx":1645
 *                     assert callable(rt)
 *                     assert resolution_func is None  # can't error and resolve
 *                     ops_.append(_Op.from_type_and_error_func(typ, rt))             # <<<<<<<<<<<<<<
 *                     continue
 *             else:
*/
        __pyx_t_4 = __pyx_v_typ;
        __Pyx_INCREF(__pyx_t_4);
        if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(0, 1645, __pyx_L1_error)
        __pyx_t_7 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_error_func(((PyObject*)__pyx_t_4), __pyx_v_rt)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_ops_, __pyx_t_7); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 1645, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "cupy/_core/_kernel.pyx":1646
 *                     assert resolution_func is None  # can't error and resolve
 *                     ops_.append(_Op.from_type_and_error_func(typ, rt))
 *                     continue             # <<<<<<<<<<<<<<
 *             else:
 *                 if not isinstance(t, (str, list)):
*/
        goto __pyx_L3_continue;

        /* "cupy/_core/_kernel.pyx":1639
 *                 elif isinstance(rt, tuple):
 *                     rt = tuple([r1 or r2 for r1, r2 in zip(rt, routine)])
 *                 elif not isinstance(rt, (str, list)):             # <<<<<<<<<<<<<<
 *                     if not callable(rt):
 *                         raise ValueError(
*/
      }
      __pyx_L9:;

      /* "cupy/_core/_kernel.pyx":1630
 *         for t in ops:
 *             resolution_func = None
 *             if isinstance(t, tuple):             # <<<<<<<<<<<<<<
 *                 typ, rt, *res_func = t
 *                 if res_func:
*/
      goto __pyx_L5;
    }

    /* "cupy/_core/_kernel.pyx":1648
 *                     continue
 *             else:
 *                 if not isinstance(t, (str, list)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         f"invalid op {t}, expected string or list")
*/
    /*else*/ {
      __pyx_t_15 = PyUnicode_Check(__pyx_v_t); 
      if (!__pyx_t_15) {
      } else {
        __pyx_t_5 = __pyx_t_15;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_15 = PyList_Check(__pyx_v_t); 
      __pyx_t_5 = __pyx_t_15;
      __pyx_L25_bool_binop_done:;
      __pyx_t_15 = (!__pyx_t_5);
      if (unlikely(__pyx_t_15)) {

        /* "cupy/_core/_kernel.pyx":1649
 *             else:
 *                 if not isinstance(t, (str, list)):
 *                     raise ValueError(             # <<<<<<<<<<<<<<
 *                         f"invalid op {t}, expected string or list")
 *                 typ, rt = t, routine
*/
        __pyx_t_4 = NULL;

        /* "cupy/_core/_kernel.pyx":1650
 *                 if not isinstance(t, (str, list)):
 *                     raise ValueError(
 *                         f"invalid op {t}, expected string or list")             # <<<<<<<<<<<<<<
 *                 typ, rt = t, routine
 * 
*/
        __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_t, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1650, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_invalid_op;
        __pyx_t_18[1] = __pyx_t_9;
        __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_expected_string_or_list;
        __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_18, 3, 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 25, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1650, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_13};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1649, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(0, 1649, __pyx_L1_error)

        /* "cupy/_core/_kernel.pyx":1648
 *                     continue
 *             else:
 *                 if not isinstance(t, (str, list)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(
 *                         f"invalid op {t}, expected string or list")
*/
      }

      /* "cupy/_core/_kernel.pyx":1651
 *                     raise ValueError(
 *                         f"invalid op {t}, expected string or list")
 *                 typ, rt = t, routine             # <<<<<<<<<<<<<<
 * 
 *             ops_.append(_Op.from_type_and_routine(typ, rt, resolution_func))
*/
      __pyx_t_7 = __pyx_v_t;
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_13 = __pyx_v_routine;
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_XDECREF_SET(__pyx_v_typ, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_rt, __pyx_t_13);
      __pyx_t_13 = 0;
    }
    __pyx_L5:;

    /* "cupy/_core/_kernel.pyx":1653
 *                 typ, rt = t, routine
 * 
 *             ops_.append(_Op.from_type_and_routine(typ, rt, resolution_func))             # <<<<<<<<<<<<<<
 *         return _Ops(tuple(ops_), promote_types=promote_types)
 * 
*/
    __pyx_t_13 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_routine(__pyx_v_typ, __pyx_v_rt, __pyx_v_resolution_func)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_ops_, __pyx_t_13); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 1653, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "cupy/_core/_kernel.pyx":1628
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):
 *         ops_ = []
 *         for t in ops:             # <<<<<<<<<<<<<<
 *             resolution_func = None
 *             if isinstance(t, tuple):
*/
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1654
 * 
 *             ops_.append(_Op.from_type_and_routine(typ, rt, resolution_func))
 *         return _Ops(tuple(ops_), promote_types=promote_types)             # <<<<<<<<<<<<<<
 * 
 *     cpdef _Op guess_routine(
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_13 = NULL;
  __pyx_t_7 = PyList_AsTuple(__pyx_v_ops_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_13, __pyx_t_7};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_promote_types, __pyx_v_promote_types, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1625
 *         self.promote_types = promote_types
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef _Ops from_tuples(object ops, routine, object promote_types=None):
 *         ops_ = []
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.from_tuples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ops_);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_resolution_func);
  __Pyx_XDECREF(__pyx_v_typ);
  __Pyx_XDECREF(__pyx_v_rt);
  __Pyx_XDECREF(__pyx_v_res_func);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r1);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_r2);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1656
 *         return _Ops(tuple(ops_), promote_types=promote_types)
 * 
 *     cpdef _Op guess_routine(             # <<<<<<<<<<<<<<
 *             self, str name, dict cache, list in_args, dtype, _Ops out_ops):
 *         cdef _Ops ops_
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3guess_routine(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops_guess_routine(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_in_args, PyObject *__pyx_v_dtype, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops, int __pyx_skip_dispatch) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_ops_ = 0;
  PyObject *__pyx_v_weaks = 0;
  PyObject *__pyx_v_in_types = 0;
  PyObject *__pyx_v_weaks_l = 0;
  PyObject *__pyx_v_in_types_l = 0;
  int __pyx_v_any_weak;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_weak_t = NULL;
  PyObject *__pyx_v_op = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types __pyx_t_11;
  PyObject *__pyx_t_12[4];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("guess_routine", 0);
  __Pyx_INCREF(__pyx_v_dtype);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_guess_routine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_4_Ops_3guess_routine)) {
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[6] = {__pyx_t_3, __pyx_v_name, __pyx_v_cache, __pyx_v_in_args, __pyx_v_dtype, ((PyObject *)__pyx_v_out_ops)};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (6-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1656, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1656, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":1661
 *         cdef tuple weaks, in_types
 *         cdef list weaks_l, in_types_l
 *         cdef bint any_weak = False             # <<<<<<<<<<<<<<
 * 
 *         if dtype is None:
*/
  __pyx_v_any_weak = 0;

  /* "cupy/_core/_kernel.pyx":1663
 *         cdef bint any_weak = False
 * 
 *         if dtype is None:             # <<<<<<<<<<<<<<
 *             weaks_l = []
 *             in_types_l = []
*/
  __pyx_t_6 = (__pyx_v_dtype == Py_None);
  if (__pyx_t_6) {

    /* "cupy/_core/_kernel.pyx":1664
 * 
 *         if dtype is None:
 *             weaks_l = []             # <<<<<<<<<<<<<<
 *             in_types_l = []
 *             for a in in_args:
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_weaks_l = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1665
 *         if dtype is None:
 *             weaks_l = []
 *             in_types_l = []             # <<<<<<<<<<<<<<
 *             for a in in_args:
 *                 if type(a) is _scalar.CScalar:
*/
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_in_types_l = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1666
 *             weaks_l = []
 *             in_types_l = []
 *             for a in in_args:             # <<<<<<<<<<<<<<
 *                 if type(a) is _scalar.CScalar:
 *                     t = (<_scalar.CScalar>a).descr
*/
    if (unlikely(__pyx_v_in_args == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1666, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_in_args; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1666, __pyx_L1_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference);
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1667
 *             in_types_l = []
 *             for a in in_args:
 *                 if type(a) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                     t = (<_scalar.CScalar>a).descr
 *                     weak_t = (<_scalar.CScalar>a).weak_t
*/
      __pyx_t_6 = (((PyObject *)Py_TYPE(__pyx_v_a)) == ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_scalar_CScalar));
      if (__pyx_t_6) {

        /* "cupy/_core/_kernel.pyx":1668
 *             for a in in_args:
 *                 if type(a) is _scalar.CScalar:
 *                     t = (<_scalar.CScalar>a).descr             # <<<<<<<<<<<<<<
 *                     weak_t = (<_scalar.CScalar>a).weak_t
 *                     if weak_t is not False:
*/
        __pyx_t_2 = ((PyObject *)((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_v_a)->descr);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "cupy/_core/_kernel.pyx":1669
 *                 if type(a) is _scalar.CScalar:
 *                     t = (<_scalar.CScalar>a).descr
 *                     weak_t = (<_scalar.CScalar>a).weak_t             # <<<<<<<<<<<<<<
 *                     if weak_t is not False:
 *                         any_weak = True
*/
        __pyx_t_2 = ((struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *)__pyx_v_a)->weak_t;
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_weak_t, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "cupy/_core/_kernel.pyx":1670
 *                     t = (<_scalar.CScalar>a).descr
 *                     weak_t = (<_scalar.CScalar>a).weak_t
 *                     if weak_t is not False:             # <<<<<<<<<<<<<<
 *                         any_weak = True
 *                 elif isinstance(a, _ndarray_base):
*/
        __pyx_t_6 = (__pyx_v_weak_t != Py_False);
        if (__pyx_t_6) {

          /* "cupy/_core/_kernel.pyx":1671
 *                     weak_t = (<_scalar.CScalar>a).weak_t
 *                     if weak_t is not False:
 *                         any_weak = True             # <<<<<<<<<<<<<<
 *                 elif isinstance(a, _ndarray_base):
 *                     t = (<_ndarray_base>a).dtype
*/
          __pyx_v_any_weak = 1;

          /* "cupy/_core/_kernel.pyx":1670
 *                     t = (<_scalar.CScalar>a).descr
 *                     weak_t = (<_scalar.CScalar>a).weak_t
 *                     if weak_t is not False:             # <<<<<<<<<<<<<<
 *                         any_weak = True
 *                 elif isinstance(a, _ndarray_base):
*/
        }

        /* "cupy/_core/_kernel.pyx":1667
 *             in_types_l = []
 *             for a in in_args:
 *                 if type(a) is _scalar.CScalar:             # <<<<<<<<<<<<<<
 *                     t = (<_scalar.CScalar>a).descr
 *                     weak_t = (<_scalar.CScalar>a).weak_t
*/
        goto __pyx_L6;
      }

      /* "cupy/_core/_kernel.pyx":1672
 *                     if weak_t is not False:
 *                         any_weak = True
 *                 elif isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *                     t = (<_ndarray_base>a).dtype
 *                     weak_t = False
*/
      __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_a, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_4core__ndarray_base); 
      if (likely(__pyx_t_6)) {

        /* "cupy/_core/_kernel.pyx":1673
 *                         any_weak = True
 *                 elif isinstance(a, _ndarray_base):
 *                     t = (<_ndarray_base>a).dtype             # <<<<<<<<<<<<<<
 *                     weak_t = False
 *                 else:
*/
        __pyx_t_2 = ((struct __pyx_obj_4cupy_5_core_4core__ndarray_base *)__pyx_v_a)->dtype;
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "cupy/_core/_kernel.pyx":1674
 *                 elif isinstance(a, _ndarray_base):
 *                     t = (<_ndarray_base>a).dtype
 *                     weak_t = False             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise RuntimeError(f"Need array or CScalar got {type(a)}")
*/
        __Pyx_INCREF(Py_False);
        __Pyx_XDECREF_SET(__pyx_v_weak_t, Py_False);

        /* "cupy/_core/_kernel.pyx":1672
 *                     if weak_t is not False:
 *                         any_weak = True
 *                 elif isinstance(a, _ndarray_base):             # <<<<<<<<<<<<<<
 *                     t = (<_ndarray_base>a).dtype
 *                     weak_t = False
*/
        goto __pyx_L6;
      }

      /* "cupy/_core/_kernel.pyx":1676
 *                     weak_t = False
 *                 else:
 *                     raise RuntimeError(f"Need array or CScalar got {type(a)}")             # <<<<<<<<<<<<<<
 * 
 *                 in_types_l.append(t)
*/
      /*else*/ {
        __pyx_t_4 = NULL;
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_a)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Need_array_or_CScalar_got, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1676, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 1676, __pyx_L1_error)
      }
      __pyx_L6:;

      /* "cupy/_core/_kernel.pyx":1678
 *                     raise RuntimeError(f"Need array or CScalar got {type(a)}")
 * 
 *                 in_types_l.append(t)             # <<<<<<<<<<<<<<
 *                 weaks_l.append(weak_t)
 * 
*/
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_in_types_l, __pyx_v_t); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1678, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1679
 * 
 *                 in_types_l.append(t)
 *                 weaks_l.append(weak_t)             # <<<<<<<<<<<<<<
 * 
 *             in_types = tuple(in_types_l)
*/
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_weaks_l, __pyx_v_weak_t); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1679, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1666
 *             weaks_l = []
 *             in_types_l = []
 *             for a in in_args:             # <<<<<<<<<<<<<<
 *                 if type(a) is _scalar.CScalar:
 *                     t = (<_scalar.CScalar>a).descr
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1681
 *                 weaks_l.append(weak_t)
 * 
 *             in_types = tuple(in_types_l)             # <<<<<<<<<<<<<<
 *             weaks = tuple(weaks_l) if any_weak else None
 * 
*/
    __pyx_t_1 = PyList_AsTuple(__pyx_v_in_types_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_in_types = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1682
 * 
 *             in_types = tuple(in_types_l)
 *             weaks = tuple(weaks_l) if any_weak else None             # <<<<<<<<<<<<<<
 * 
 *             if not _check_should_use_weak_scalar(in_types, weaks):
*/
    if (__pyx_v_any_weak) {
      __pyx_t_2 = PyList_AsTuple(__pyx_v_weaks_l); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 1682, __pyx_L1_error)
    __pyx_v_weaks = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cupy/_core/_kernel.pyx":1684
 *             weaks = tuple(weaks_l) if any_weak else None
 * 
 *             if not _check_should_use_weak_scalar(in_types, weaks):             # <<<<<<<<<<<<<<
 *                 weaks = (False,) * len(in_args)
 * 
*/
    __pyx_t_6 = __pyx_f_4cupy_5_core_7_kernel__check_should_use_weak_scalar(__pyx_v_in_types, __pyx_v_weaks); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1684, __pyx_L1_error)
    __pyx_t_10 = (!__pyx_t_6);
    if (__pyx_t_10) {

      /* "cupy/_core/_kernel.pyx":1685
 * 
 *             if not _check_should_use_weak_scalar(in_types, weaks):
 *                 weaks = (False,) * len(in_args)             # <<<<<<<<<<<<<<
 * 
 *             op = cache.get((in_types, weaks), ())
*/
      if (unlikely(__pyx_v_in_args == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 1685, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyList_GET_SIZE(__pyx_v_in_args); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1685, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[5], __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_weaks, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "cupy/_core/_kernel.pyx":1684
 *             weaks = tuple(weaks_l) if any_weak else None
 * 
 *             if not _check_should_use_weak_scalar(in_types, weaks):             # <<<<<<<<<<<<<<
 *                 weaks = (False,) * len(in_args)
 * 
*/
    }

    /* "cupy/_core/_kernel.pyx":1687
 *                 weaks = (False,) * len(in_args)
 * 
 *             op = cache.get((in_types, weaks), ())             # <<<<<<<<<<<<<<
 *             if op is ():
 *                 op = self._guess_routine_from_in_types(in_types, weaks)
*/
    if (unlikely(__pyx_v_cache == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
      __PYX_ERR(0, 1687, __pyx_L1_error)
    }
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_in_types);
    __Pyx_GIVEREF(__pyx_v_in_types);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_in_types) != (0)) __PYX_ERR(0, 1687, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_weaks);
    __Pyx_GIVEREF(__pyx_v_weaks);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_weaks) != (0)) __PYX_ERR(0, 1687, __pyx_L1_error);
    __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_cache, __pyx_t_1, __pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_op = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1688
 * 
 *             op = cache.get((in_types, weaks), ())
 *             if op is ():             # <<<<<<<<<<<<<<
 *                 op = self._guess_routine_from_in_types(in_types, weaks)
 *                 cache[(in_types, weaks)] = op
*/
    __pyx_t_10 = (__pyx_v_op == __pyx_mstate_global->__pyx_empty_tuple);
    if (__pyx_t_10) {

      /* "cupy/_core/_kernel.pyx":1689
 *             op = cache.get((in_types, weaks), ())
 *             if op is ():
 *                 op = self._guess_routine_from_in_types(in_types, weaks)             # <<<<<<<<<<<<<<
 *                 cache[(in_types, weaks)] = op
 *         else:
*/
      __pyx_t_11.__pyx_n = 1;
      __pyx_t_11.weaks = __pyx_v_weaks;
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops *)__pyx_v_self->__pyx_vtab)->_guess_routine_from_in_types(__pyx_v_self, __pyx_v_in_types, 0, &__pyx_t_11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_op, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1690
 *             if op is ():
 *                 op = self._guess_routine_from_in_types(in_types, weaks)
 *                 cache[(in_types, weaks)] = op             # <<<<<<<<<<<<<<
 *         else:
 *             op = cache.get(dtype, ())
*/
      if (unlikely(__pyx_v_cache == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1690, __pyx_L1_error)
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_in_types);
      __Pyx_GIVEREF(__pyx_v_in_types);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_types) != (0)) __PYX_ERR(0, 1690, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_weaks);
      __Pyx_GIVEREF(__pyx_v_weaks);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_weaks) != (0)) __PYX_ERR(0, 1690, __pyx_L1_error);
      if (unlikely((PyDict_SetItem(__pyx_v_cache, __pyx_t_2, __pyx_v_op) < 0))) __PYX_ERR(0, 1690, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1688
 * 
 *             op = cache.get((in_types, weaks), ())
 *             if op is ():             # <<<<<<<<<<<<<<
 *                 op = self._guess_routine_from_in_types(in_types, weaks)
 *                 cache[(in_types, weaks)] = op
*/
    }

    /* "cupy/_core/_kernel.pyx":1663
 *         cdef bint any_weak = False
 * 
 *         if dtype is None:             # <<<<<<<<<<<<<<
 *             weaks_l = []
 *             in_types_l = []
*/
    goto __pyx_L3;
  }

  /* "cupy/_core/_kernel.pyx":1692
 *                 cache[(in_types, weaks)] = op
 *         else:
 *             op = cache.get(dtype, ())             # <<<<<<<<<<<<<<
 *             if op is ():
 *                 ops_ = out_ops or self
*/
  /*else*/ {
    if (unlikely(__pyx_v_cache == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
      __PYX_ERR(0, 1692, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_cache, __pyx_v_dtype, __pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_op = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1693
 *         else:
 *             op = cache.get(dtype, ())
 *             if op is ():             # <<<<<<<<<<<<<<
 *                 ops_ = out_ops or self
 *                 op = ops_._guess_routine_from_dtype(dtype)
*/
    __pyx_t_10 = (__pyx_v_op == __pyx_mstate_global->__pyx_empty_tuple);
    if (__pyx_t_10) {

      /* "cupy/_core/_kernel.pyx":1694
 *             op = cache.get(dtype, ())
 *             if op is ():
 *                 ops_ = out_ops or self             # <<<<<<<<<<<<<<
 *                 op = ops_._guess_routine_from_dtype(dtype)
 *                 cache[dtype] = op
*/
      __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_out_ops)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 1694, __pyx_L1_error)
      if (!__pyx_t_10) {
      } else {
        __Pyx_INCREF((PyObject *)__pyx_v_out_ops);
        __pyx_t_2 = ((PyObject *)__pyx_v_out_ops);
        goto __pyx_L12_bool_binop_done;
      }
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __pyx_t_2 = ((PyObject *)__pyx_v_self);
      __pyx_L12_bool_binop_done:;
      __pyx_v_ops_ = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1695
 *             if op is ():
 *                 ops_ = out_ops or self
 *                 op = ops_._guess_routine_from_dtype(dtype)             # <<<<<<<<<<<<<<
 *                 cache[dtype] = op
 * 
*/
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops *)__pyx_v_ops_->__pyx_vtab)->_guess_routine_from_dtype(__pyx_v_ops_, __pyx_v_dtype, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1695, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_op, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1696
 *                 ops_ = out_ops or self
 *                 op = ops_._guess_routine_from_dtype(dtype)
 *                 cache[dtype] = op             # <<<<<<<<<<<<<<
 * 
 *         if op is not None:
*/
      if (unlikely(__pyx_v_cache == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1696, __pyx_L1_error)
      }
      if (unlikely((PyDict_SetItem(__pyx_v_cache, __pyx_v_dtype, __pyx_v_op) < 0))) __PYX_ERR(0, 1696, __pyx_L1_error)

      /* "cupy/_core/_kernel.pyx":1693
 *         else:
 *             op = cache.get(dtype, ())
 *             if op is ():             # <<<<<<<<<<<<<<
 *                 ops_ = out_ops or self
 *                 op = ops_._guess_routine_from_dtype(dtype)
*/
    }
  }
  __pyx_L3:;

  /* "cupy/_core/_kernel.pyx":1698
 *                 cache[dtype] = op
 * 
 *         if op is not None:             # <<<<<<<<<<<<<<
 *             # raise TypeError if the type combination is disallowed
 *             (<_Op>op).check_valid()
*/
  __pyx_t_10 = (__pyx_v_op != Py_None);
  if (__pyx_t_10) {

    /* "cupy/_core/_kernel.pyx":1700
 *         if op is not None:
 *             # raise TypeError if the type combination is disallowed
 *             (<_Op>op).check_valid()             # <<<<<<<<<<<<<<
 *             return op
 * 
*/
    __pyx_t_2 = ((struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op *)((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_op)->__pyx_vtab)->check_valid(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_op)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1701
 *             # raise TypeError if the type combination is disallowed
 *             (<_Op>op).check_valid()
 *             return op             # <<<<<<<<<<<<<<
 * 
 *         if dtype is None:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    if (!(likely(((__pyx_v_op) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_op, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1701, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_op);
    __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v_op);
    goto __pyx_L0;

    /* "cupy/_core/_kernel.pyx":1698
 *                 cache[dtype] = op
 * 
 *         if op is not None:             # <<<<<<<<<<<<<<
 *             # raise TypeError if the type combination is disallowed
 *             (<_Op>op).check_valid()
*/
  }

  /* "cupy/_core/_kernel.pyx":1703
 *             return op
 * 
 *         if dtype is None:             # <<<<<<<<<<<<<<
 *             dtype = in_types
 *         raise TypeError('Wrong type (%s) of arguments for %s' %
*/
  __pyx_t_10 = (__pyx_v_dtype == Py_None);
  if (__pyx_t_10) {

    /* "cupy/_core/_kernel.pyx":1704
 * 
 *         if dtype is None:
 *             dtype = in_types             # <<<<<<<<<<<<<<
 *         raise TypeError('Wrong type (%s) of arguments for %s' %
 *                         (dtype, name))
*/
    if (unlikely(!__pyx_v_in_types)) { __Pyx_RaiseUnboundLocalError("in_types"); __PYX_ERR(0, 1704, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_v_in_types);
    __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_v_in_types);

    /* "cupy/_core/_kernel.pyx":1703
 *             return op
 * 
 *         if dtype is None:             # <<<<<<<<<<<<<<
 *             dtype = in_types
 *         raise TypeError('Wrong type (%s) of arguments for %s' %
*/
  }

  /* "cupy/_core/_kernel.pyx":1705
 *         if dtype is None:
 *             dtype = in_types
 *         raise TypeError('Wrong type (%s) of arguments for %s' %             # <<<<<<<<<<<<<<
 *                         (dtype, name))
 * 
*/
  __pyx_t_1 = NULL;

  /* "cupy/_core/_kernel.pyx":1706
 *             dtype = in_types
 *         raise TypeError('Wrong type (%s) of arguments for %s' %
 *                         (dtype, name))             # <<<<<<<<<<<<<<
 * 
 *     cpdef _Op _guess_routine_from_in_types(
*/
  __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_dtype), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_Wrong_type;
  __pyx_t_12[1] = __pyx_t_8;
  __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u_of_arguments_for;
  __pyx_t_12[3] = __pyx_t_4;

  /* "cupy/_core/_kernel.pyx":1705
 *         if dtype is None:
 *             dtype = in_types
 *         raise TypeError('Wrong type (%s) of arguments for %s' %             # <<<<<<<<<<<<<<
 *                         (dtype, name))
 * 
*/
  __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 19 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 1705, __pyx_L1_error)

  /* "cupy/_core/_kernel.pyx":1656
 *         return _Ops(tuple(ops_), promote_types=promote_types)
 * 
 *     cpdef _Op guess_routine(             # <<<<<<<<<<<<<<
 *             self, str name, dict cache, list in_args, dtype, _Ops out_ops):
 *         cdef _Ops ops_
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.guess_routine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ops_);
  __Pyx_XDECREF(__pyx_v_weaks);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_weaks_l);
  __Pyx_XDECREF(__pyx_v_in_types_l);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_weak_t);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3guess_routine(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_Ops_2guess_routine, "_Ops.guess_routine(self, str name, dict cache, list in_args, dtype, _Ops out_ops) -> _Op");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3guess_routine(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_cache = 0;
  PyObject *__pyx_v_in_args = 0;
  PyObject *__pyx_v_dtype = 0;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("guess_routine (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_cache,&__pyx_mstate_global->__pyx_n_u_in_args,&__pyx_mstate_global->__pyx_n_u_dtype,&__pyx_mstate_global->__pyx_n_u_out_ops,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1656, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1656, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "guess_routine", 0) < (0)) __PYX_ERR(0, 1656, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("guess_routine", 1, 5, 5, i); __PYX_ERR(0, 1656, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1656, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1656, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1656, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1656, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1656, __pyx_L3_error)
    }
    __pyx_v_name = ((PyObject*)values[0]);
    __pyx_v_cache = ((PyObject*)values[1]);
    __pyx_v_in_args = ((PyObject*)values[2]);
    __pyx_v_dtype = values[3];
    __pyx_v_out_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)values[4]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("guess_routine", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1656, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Ops.guess_routine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 1657, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cache), (&PyDict_Type), 1, "cache", 1))) __PYX_ERR(0, 1657, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_args), (&PyList_Type), 1, "in_args", 1))) __PYX_ERR(0, 1657, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_ops), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops, 1, "out_ops", 0))) __PYX_ERR(0, 1657, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_2guess_routine(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self), __pyx_v_name, __pyx_v_cache, __pyx_v_in_args, __pyx_v_dtype, __pyx_v_out_ops);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_2guess_routine(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_in_args, PyObject *__pyx_v_dtype, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_out_ops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("guess_routine", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_4_Ops_guess_routine(__pyx_v_self, __pyx_v_name, __pyx_v_cache, __pyx_v_in_args, __pyx_v_dtype, __pyx_v_out_ops, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.guess_routine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1708
 *                         (dtype, name))
 * 
 *     cpdef _Op _guess_routine_from_in_types(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple weaks=None,
 *             object can_cast=_numpy_can_cast
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_5_guess_routine_from_in_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_in_types, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types *__pyx_optional_args) {

  /* "cupy/_core/_kernel.pyx":1709
 * 
 *     cpdef _Op _guess_routine_from_in_types(
 *             self, tuple in_types, tuple weaks=None,             # <<<<<<<<<<<<<<
 *             object can_cast=_numpy_can_cast
 *     ):
*/
  PyObject *__pyx_v_weaks = ((PyObject*)Py_None);
  PyObject *__pyx_v_can_cast = __pyx_mstate_global->__pyx_k__21;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_op = 0;
  PyObject *__pyx_v_op_types = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_it = NULL;
  PyObject *__pyx_v_ot = NULL;
  PyObject *__pyx_v_weak_t = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_guess_routine_from_in_types", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_weaks = __pyx_optional_args->weaks;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_can_cast = __pyx_optional_args->can_cast;
      }
    }
  }
  __Pyx_INCREF(__pyx_v_in_types);
  __Pyx_INCREF(__pyx_v_weaks);

  /* "cupy/_core/_kernel.pyx":1708
 *                         (dtype, name))
 * 
 *     cpdef _Op _guess_routine_from_in_types(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple weaks=None,
 *             object can_cast=_numpy_can_cast
*/
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_guess_routine_from_in_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_4_Ops_5_guess_routine_from_in_types)) {
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_in_types, __pyx_v_weaks, __pyx_v_can_cast};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1708, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1708, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":1716
 *         cdef int i
 * 
 *         if self.promote_types is not None:             # <<<<<<<<<<<<<<
 *             # NOTE(seberg): This works fine, but should maybe be considered
 *             # in flux. NumPy needs more (but mostly for loop registration).
*/
  __pyx_t_6 = (__pyx_v_self->promote_types != Py_None);
  if (__pyx_t_6) {

    /* "cupy/_core/_kernel.pyx":1719
 *             # NOTE(seberg): This works fine, but should maybe be considered
 *             # in flux. NumPy needs more (but mostly for loop registration).
 *             in_types, weaks = self.promote_types(in_types, weaks)             # <<<<<<<<<<<<<<
 * 
 *         for op in self.ops:
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_self->promote_types);
    __pyx_t_4 = __pyx_v_self->promote_types; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_in_types, __pyx_v_weaks};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1719, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_2);
      } else {
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
      }
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1719, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_4))) __PYX_ERR(0, 1719, __pyx_L1_error)
    if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 1719, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_in_types, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_weaks, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1716
 *         cdef int i
 * 
 *         if self.promote_types is not None:             # <<<<<<<<<<<<<<
 *             # NOTE(seberg): This works fine, but should maybe be considered
 *             # in flux. NumPy needs more (but mostly for loop registration).
*/
  }

  /* "cupy/_core/_kernel.pyx":1721
 *             in_types, weaks = self.promote_types(in_types, weaks)
 * 
 *         for op in self.ops:             # <<<<<<<<<<<<<<
 *             op_types = op.in_types
 *             for i in range(self.nin):
*/
  if (unlikely(__pyx_v_self->ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1721, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->ops; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_8 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1721, __pyx_L1_error)
      #endif
      if (__pyx_t_8 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8));
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_8);
    #endif
    ++__pyx_t_8;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1721, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1721, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_op, ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1722
 * 
 *         for op in self.ops:
 *             op_types = op.in_types             # <<<<<<<<<<<<<<
 *             for i in range(self.nin):
 *                 it = in_types[i]
*/
    __pyx_t_2 = __pyx_v_op->in_types;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_op_types, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1723
 *         for op in self.ops:
 *             op_types = op.in_types
 *             for i in range(self.nin):             # <<<<<<<<<<<<<<
 *                 it = in_types[i]
 *                 ot = op_types[i]
*/
    __pyx_t_9 = __pyx_v_self->nin;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "cupy/_core/_kernel.pyx":1724
 *             op_types = op.in_types
 *             for i in range(self.nin):
 *                 it = in_types[i]             # <<<<<<<<<<<<<<
 *                 ot = op_types[i]
 *                 weak_t = weaks[i] if weaks is not None else False
*/
      if (unlikely(__pyx_v_in_types == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1724, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_in_types, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_it, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1725
 *             for i in range(self.nin):
 *                 it = in_types[i]
 *                 ot = op_types[i]             # <<<<<<<<<<<<<<
 *                 weak_t = weaks[i] if weaks is not None else False
 * 
*/
      if (unlikely(__pyx_v_op_types == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1725, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_op_types, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_ot, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1726
 *                 it = in_types[i]
 *                 ot = op_types[i]
 *                 weak_t = weaks[i] if weaks is not None else False             # <<<<<<<<<<<<<<
 * 
 *                 if not can_cast(it, ot):
*/
      __pyx_t_6 = (__pyx_v_weaks != ((PyObject*)Py_None));
      if (__pyx_t_6) {
        if (unlikely(__pyx_v_weaks == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1726, __pyx_L1_error)
        }
        __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_weaks, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_False);
        __pyx_t_2 = Py_False;
      }
      __Pyx_XDECREF_SET(__pyx_v_weak_t, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":1728
 *                 weak_t = weaks[i] if weaks is not None else False
 * 
 *                 if not can_cast(it, ot):             # <<<<<<<<<<<<<<
 *                     if not weak_t:
 *                         break
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_can_cast);
      __pyx_t_3 = __pyx_v_can_cast; 
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_it, __pyx_v_ot};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1728, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = (!__pyx_t_6);
      if (__pyx_t_12) {

        /* "cupy/_core/_kernel.pyx":1729
 * 
 *                 if not can_cast(it, ot):
 *                     if not weak_t:             # <<<<<<<<<<<<<<
 *                         break
 * 
*/
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_weak_t); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 1729, __pyx_L1_error)
        __pyx_t_6 = (!__pyx_t_12);
        if (__pyx_t_6) {

          /* "cupy/_core/_kernel.pyx":1730
 *                 if not can_cast(it, ot):
 *                     if not weak_t:
 *                         break             # <<<<<<<<<<<<<<
 * 
 *                     # If `result_type` doesn't return `ot` then the weak
*/
          goto __pyx_L9_break;

          /* "cupy/_core/_kernel.pyx":1729
 * 
 *                 if not can_cast(it, ot):
 *                     if not weak_t:             # <<<<<<<<<<<<<<
 *                         break
 * 
*/
        }

        /* "cupy/_core/_kernel.pyx":1734
 *                     # If `result_type` doesn't return `ot` then the weak
 *                     # scalar caused promotion and operand cannot be used.
 *                     try:             # <<<<<<<<<<<<<<
 *                         if _numpy_result_type(weak_t(0), ot) != ot:
 *                             break
*/
        {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          /*try:*/ {

            /* "cupy/_core/_kernel.pyx":1735
 *                     # scalar caused promotion and operand cannot be used.
 *                     try:
 *                         if _numpy_result_type(weak_t(0), ot) != ot:             # <<<<<<<<<<<<<<
 *                             break
 *                     except TypeError:
*/
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_v_4cupy_5_core_7_kernel__numpy_result_type);
            __pyx_t_4 = __pyx_v_4cupy_5_core_7_kernel__numpy_result_type; 
            __pyx_t_17 = NULL;
            __Pyx_INCREF(__pyx_v_weak_t);
            __pyx_t_18 = __pyx_v_weak_t; 
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_18))) {
              __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
              assert(__pyx_t_17);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_18);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_18, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_mstate_global->__pyx_int_0};
              __pyx_t_16 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_18, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
              if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1735, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_16);
            }
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_16, __pyx_v_ot};
              __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1735, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_ot, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1735, __pyx_L12_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1735, __pyx_L12_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (__pyx_t_6) {

              /* "cupy/_core/_kernel.pyx":1736
 *                     try:
 *                         if _numpy_result_type(weak_t(0), ot) != ot:
 *                             break             # <<<<<<<<<<<<<<
 *                     except TypeError:
 *                         break
*/
              goto __pyx_L17_try_break;

              /* "cupy/_core/_kernel.pyx":1735
 *                     # scalar caused promotion and operand cannot be used.
 *                     try:
 *                         if _numpy_result_type(weak_t(0), ot) != ot:             # <<<<<<<<<<<<<<
 *                             break
 *                     except TypeError:
*/
            }

            /* "cupy/_core/_kernel.pyx":1734
 *                     # If `result_type` doesn't return `ot` then the weak
 *                     # scalar caused promotion and operand cannot be used.
 *                     try:             # <<<<<<<<<<<<<<
 *                         if _numpy_result_type(weak_t(0), ot) != ot:
 *                             break
*/
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "cupy/_core/_kernel.pyx":1737
 *                         if _numpy_result_type(weak_t(0), ot) != ot:
 *                             break
 *                     except TypeError:             # <<<<<<<<<<<<<<
 *                         break
 *             else:
*/
          __pyx_t_19 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
          if (__pyx_t_19) {
            __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_in_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_16) < 0) __PYX_ERR(0, 1737, __pyx_L14_except_error)
            __Pyx_XGOTREF(__pyx_t_4);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_t_16);

            /* "cupy/_core/_kernel.pyx":1738
 *                             break
 *                     except TypeError:
 *                         break             # <<<<<<<<<<<<<<
 *             else:
 *                 return op
*/
            goto __pyx_L22_except_break;
            __pyx_L22_except_break:;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
            goto __pyx_L17_try_break;
          }
          goto __pyx_L14_except_error;

          /* "cupy/_core/_kernel.pyx":1734
 *                     # If `result_type` doesn't return `ot` then the weak
 *                     # scalar caused promotion and operand cannot be used.
 *                     try:             # <<<<<<<<<<<<<<
 *                         if _numpy_result_type(weak_t(0), ot) != ot:
 *                             break
*/
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          goto __pyx_L1_error;
          __pyx_L17_try_break:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          goto __pyx_L9_break;
          __pyx_L19_try_end:;
        }

        /* "cupy/_core/_kernel.pyx":1728
 *                 weak_t = weaks[i] if weaks is not None else False
 * 
 *                 if not can_cast(it, ot):             # <<<<<<<<<<<<<<
 *                     if not weak_t:
 *                         break
*/
      }
    }
    /*else*/ {

      /* "cupy/_core/_kernel.pyx":1740
 *                         break
 *             else:
 *                 return op             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_op);
      __pyx_r = __pyx_v_op;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_break:;

    /* "cupy/_core/_kernel.pyx":1721
 *             in_types, weaks = self.promote_types(in_types, weaks)
 * 
 *         for op in self.ops:             # <<<<<<<<<<<<<<
 *             op_types = op.in_types
 *             for i in range(self.nin):
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1741
 *             else:
 *                 return op
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cpdef _Op _guess_routine_from_dtype(self, object dtype):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1708
 *                         (dtype, name))
 * 
 *     cpdef _Op _guess_routine_from_in_types(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple weaks=None,
 *             object can_cast=_numpy_can_cast
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_in_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_op_types);
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_ot);
  __Pyx_XDECREF(__pyx_v_weak_t);
  __Pyx_XDECREF(__pyx_v_in_types);
  __Pyx_XDECREF(__pyx_v_weaks);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_5_guess_routine_from_in_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_Ops_4_guess_routine_from_in_types, "_Ops._guess_routine_from_in_types(self, tuple in_types, tuple weaks=None, can_cast=_numpy_can_cast) -> _Op");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_5_guess_routine_from_in_types(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_in_types = 0;
  PyObject *__pyx_v_weaks = 0;
  PyObject *__pyx_v_can_cast = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_guess_routine_from_in_types (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_in_types,&__pyx_mstate_global->__pyx_n_u_weaks,&__pyx_mstate_global->__pyx_n_u_can_cast,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1708, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1708, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1708, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1708, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_guess_routine_from_in_types", 0) < (0)) __PYX_ERR(0, 1708, __pyx_L3_error)

      /* "cupy/_core/_kernel.pyx":1709
 * 
 *     cpdef _Op _guess_routine_from_in_types(
 *             self, tuple in_types, tuple weaks=None,             # <<<<<<<<<<<<<<
 *             object can_cast=_numpy_can_cast
 *     ):
*/
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject*)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__21);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_guess_routine_from_in_types", 0, 1, 3, i); __PYX_ERR(0, 1708, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1708, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1708, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1708, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject*)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__21);
    }
    __pyx_v_in_types = ((PyObject*)values[0]);
    __pyx_v_weaks = ((PyObject*)values[1]);
    __pyx_v_can_cast = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_guess_routine_from_in_types", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1708, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_in_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_types), (&PyTuple_Type), 1, "in_types", 1))) __PYX_ERR(0, 1709, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weaks), (&PyTuple_Type), 1, "weaks", 1))) __PYX_ERR(0, 1709, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_4_guess_routine_from_in_types(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self), __pyx_v_in_types, __pyx_v_weaks, __pyx_v_can_cast);

  /* "cupy/_core/_kernel.pyx":1708
 *                         (dtype, name))
 * 
 *     cpdef _Op _guess_routine_from_in_types(             # <<<<<<<<<<<<<<
 *             self, tuple in_types, tuple weaks=None,
 *             object can_cast=_numpy_can_cast
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_4_guess_routine_from_in_types(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_in_types, PyObject *__pyx_v_weaks, PyObject *__pyx_v_can_cast) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_guess_routine_from_in_types", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.weaks = __pyx_v_weaks;
  __pyx_t_2.can_cast = __pyx_v_can_cast;
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4cupy_5_core_7_kernel__Ops->_guess_routine_from_in_types(__pyx_v_self, __pyx_v_in_types, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_in_types", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1743
 *         return None
 * 
 *     cpdef _Op _guess_routine_from_dtype(self, object dtype):             # <<<<<<<<<<<<<<
 *         cdef _Op op
 *         cdef tuple op_types
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_7_guess_routine_from_dtype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_dtype(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_dtype, int __pyx_skip_dispatch) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v_op = 0;
  PyObject *__pyx_v_op_types = 0;
  PyObject *__pyx_v_t = NULL;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_guess_routine_from_dtype", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (
  #if !CYTHON_USE_TYPE_SLOTS
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops &&
  __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
  #else
  unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
  #endif
  ) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_guess_routine_from_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1743, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_4cupy_5_core_7_kernel_4_Ops_7_guess_routine_from_dtype)) {
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = __pyx_t_1; 
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_dtype};
          __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1743, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1743, __pyx_L1_error)
        __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "cupy/_core/_kernel.pyx":1746
 *         cdef _Op op
 *         cdef tuple op_types
 *         for op in self.ops:             # <<<<<<<<<<<<<<
 *             op_types = op.out_types
 *             for t in op_types:
*/
  if (unlikely(__pyx_v_self->ops == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1746, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->ops; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_6 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1746, __pyx_L1_error)
      #endif
      if (__pyx_t_6 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6));
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6);
    #endif
    ++__pyx_t_6;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op))))) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_op, ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1747
 *         cdef tuple op_types
 *         for op in self.ops:
 *             op_types = op.out_types             # <<<<<<<<<<<<<<
 *             for t in op_types:
 *                 if t != dtype:
*/
    __pyx_t_2 = __pyx_v_op->out_types;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_op_types, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cupy/_core/_kernel.pyx":1748
 *         for op in self.ops:
 *             op_types = op.out_types
 *             for t in op_types:             # <<<<<<<<<<<<<<
 *                 if t != dtype:
 *                     break
*/
    if (unlikely(__pyx_v_op_types == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1748, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_v_op_types; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1748, __pyx_L1_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7));
      #else
      __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_7);
      #endif
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1748, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "cupy/_core/_kernel.pyx":1749
 *             op_types = op.out_types
 *             for t in op_types:
 *                 if t != dtype:             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_v_dtype, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1749, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1749, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_8) {

        /* "cupy/_core/_kernel.pyx":1750
 *             for t in op_types:
 *                 if t != dtype:
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 return op
*/
        goto __pyx_L6_break;

        /* "cupy/_core/_kernel.pyx":1749
 *             op_types = op.out_types
 *             for t in op_types:
 *                 if t != dtype:             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
      }

      /* "cupy/_core/_kernel.pyx":1748
 *         for op in self.ops:
 *             op_types = op.out_types
 *             for t in op_types:             # <<<<<<<<<<<<<<
 *                 if t != dtype:
 *                     break
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L8_for_else;
    __pyx_L6_break:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L9_for_end;
    /*else*/ {
      __pyx_L8_for_else:;

      /* "cupy/_core/_kernel.pyx":1752
 *                     break
 *             else:
 *                 return op             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_op);
      __pyx_r = __pyx_v_op;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __pyx_L9_for_end:;

    /* "cupy/_core/_kernel.pyx":1746
 *         cdef _Op op
 *         cdef tuple op_types
 *         for op in self.ops:             # <<<<<<<<<<<<<<
 *             op_types = op.out_types
 *             for t in op_types:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1753
 *             else:
 *                 return op
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_r = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1743
 *         return None
 * 
 *     cpdef _Op _guess_routine_from_dtype(self, object dtype):             # <<<<<<<<<<<<<<
 *         cdef _Op op
 *         cdef tuple op_types
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_op_types);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_7_guess_routine_from_dtype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_Ops_6_guess_routine_from_dtype, "_Ops._guess_routine_from_dtype(self, dtype) -> _Op");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_7_guess_routine_from_dtype(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_dtype = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_guess_routine_from_dtype (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dtype,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1743, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1743, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_guess_routine_from_dtype", 0) < (0)) __PYX_ERR(0, 1743, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_guess_routine_from_dtype", 1, 1, 1, i); __PYX_ERR(0, 1743, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1743, __pyx_L3_error)
    }
    __pyx_v_dtype = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_guess_routine_from_dtype", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1743, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_6_guess_routine_from_dtype(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self), __pyx_v_dtype);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_6_guess_routine_from_dtype(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v_dtype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_guess_routine_from_dtype", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_dtype(__pyx_v_self, __pyx_v_dtype, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Ops._guess_routine_from_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":132
 * 
 *     cdef:
 *         readonly tuple ops             # <<<<<<<<<<<<<<
 *         readonly int nin
 *         readonly int nout
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3ops_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3ops_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_3ops___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_3ops___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->ops);
  __pyx_r = __pyx_v_self->ops;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":133
 *     cdef:
 *         readonly tuple ops
 *         readonly int nin             # <<<<<<<<<<<<<<
 *         readonly int nout
 *         readonly object promote_types
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3nin_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3nin_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_3nin___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_3nin___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.nin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":134
 *         readonly tuple ops
 *         readonly int nin
 *         readonly int nout             # <<<<<<<<<<<<<<
 *         readonly object promote_types
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_4nout_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_4nout_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_4nout___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_4nout___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nout); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.nout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pxd":135
 *         readonly int nin
 *         readonly int nout
 *         readonly object promote_types             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_13promote_types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_13promote_types_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_13promote_types___get__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_13promote_types___get__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->promote_types);
  __pyx_r = __pyx_v_self->promote_types;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_Ops_8__reduce_cython__, "_Ops.__reduce_cython__(self)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_9__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_8__reduce_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_8__reduce_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.nin, self.nout, self.ops, self.promote_types)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->nin); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->nout); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->ops);
  __Pyx_GIVEREF(__pyx_v_self->ops);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->ops) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_self->promote_types);
  __Pyx_GIVEREF(__pyx_v_self->promote_types);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->promote_types) != (0)) __PYX_ERR(7, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.nin, self.nout, self.ops, self.promote_types)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v__dict = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":7
 *     state = (self.nin, self.nout, self.ops, self.promote_types)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_5 = (__pyx_v__dict != Py_None);
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(7, 7, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict) != (0)) __PYX_ERR(7, 8, __pyx_L1_error);
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.ops is not None or self.promote_types is not None
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.nin, self.nout, self.ops, self.promote_types)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.ops is not None or self.promote_types is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, None), state
*/
  /*else*/ {
    __pyx_t_5 = (__pyx_v_self->ops != ((PyObject*)Py_None));
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_self->promote_types != Py_None);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_4;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.ops is not None or self.promote_types is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.ops is not None or self.promote_types is not None
 *     if use_setstate:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Ops); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_27370516);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_27370516);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_27370516) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 13, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.ops is not None or self.promote_types is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, None), state
 *     else:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__Ops__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Ops); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_27370516);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_27370516);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_27370516) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(7, 15, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__Ops__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_4_Ops_10__setstate_cython__, "_Ops.__setstate_cython__(self, __pyx_state)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_4_Ops_11__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(7, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(7, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(7, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel._Ops.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_4_Ops_10__setstate_cython__(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_4_Ops_10__setstate_cython__(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle__Ops__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(7, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Ops__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle__Ops, (type(self), 0x1a1a414, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle__Ops__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy._core._kernel._Ops.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/_core/_kernel.pyx":1756
 * 
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',             # <<<<<<<<<<<<<<
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
*/

static PyObject *__pyx_pw_4cupy_5_core_7_kernel_19create_ufunc(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_4cupy_5_core_7_kernel_create_ufunc(PyObject *__pyx_v_name, PyObject *__pyx_v_ops, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc *__pyx_optional_args) {
  PyObject *__pyx_v_routine = ((PyObject *)Py_None);
  PyObject *__pyx_v_preamble = ((PyObject *)__pyx_mstate_global->__pyx_kp_u__3);
  PyObject *__pyx_v_doc = ((PyObject *)__pyx_mstate_global->__pyx_kp_u__3);

  /* "cupy/_core/_kernel.pyx":1757
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,             # <<<<<<<<<<<<<<
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):
*/
  PyObject *__pyx_v_default_casting = ((PyObject *)Py_None);
  PyObject *__pyx_v_loop_prep = ((PyObject *)__pyx_mstate_global->__pyx_kp_u__3);
  PyObject *__pyx_v_out_ops = ((PyObject *)Py_None);

  /* "cupy/_core/_kernel.pyx":1758
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,             # <<<<<<<<<<<<<<
 *                    promote_types=None):
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
*/
  PyObject *__pyx_v_cutensor_op = ((PyObject *)Py_None);
  PyObject *__pyx_v_scatter_op = ((PyObject *)Py_None);

  /* "cupy/_core/_kernel.pyx":1759
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):             # <<<<<<<<<<<<<<
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
*/
  PyObject *__pyx_v_promote_types = ((PyObject *)Py_None);
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v_ops_ = NULL;
  PyObject *__pyx_v__out_ops = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_ufunc", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_routine = __pyx_optional_args->routine;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_preamble = __pyx_optional_args->preamble;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_doc = __pyx_optional_args->doc;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_default_casting = __pyx_optional_args->default_casting;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_loop_prep = __pyx_optional_args->loop_prep;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_out_ops = __pyx_optional_args->out_ops;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_cutensor_op = __pyx_optional_args->cutensor_op;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_scatter_op = __pyx_optional_args->scatter_op;
                    if (__pyx_optional_args->__pyx_n > 8) {
                      __pyx_v_promote_types = __pyx_optional_args->promote_types;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  /* "cupy/_core/_kernel.pyx":1760
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)             # <<<<<<<<<<<<<<
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
 *         out_ops, routine, promote_types)
*/
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.promote_types = __pyx_v_promote_types;
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_4cupy_5_core_7_kernel__Ops->from_tuples(__pyx_v_ops, __pyx_v_routine, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ops_ = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1761
 *                    promote_types=None):
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(             # <<<<<<<<<<<<<<
 *         out_ops, routine, promote_types)
 *     return ufunc(
*/
  __pyx_t_3 = (__pyx_v_out_ops == Py_None);
  if (__pyx_t_3) {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  } else {

    /* "cupy/_core/_kernel.pyx":1762
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
 *         out_ops, routine, promote_types)             # <<<<<<<<<<<<<<
 *     return ufunc(
 *         name, ops_.nin, ops_.nout, ops_, preamble,
*/
    __pyx_t_2.__pyx_n = 1;
    __pyx_t_2.promote_types = __pyx_v_promote_types;
    __pyx_t_4 = ((PyObject *)__pyx_vtabptr_4cupy_5_core_7_kernel__Ops->from_tuples(__pyx_v_out_ops, __pyx_v_routine, &__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_v__out_ops = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/_core/_kernel.pyx":1763
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
 *         out_ops, routine, promote_types)
 *     return ufunc(             # <<<<<<<<<<<<<<
 *         name, ops_.nin, ops_.nout, ops_, preamble,
 *         loop_prep, doc, default_casting=default_casting, out_ops=_out_ops,
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;

  /* "cupy/_core/_kernel.pyx":1764
 *         out_ops, routine, promote_types)
 *     return ufunc(
 *         name, ops_.nin, ops_.nout, ops_, preamble,             # <<<<<<<<<<<<<<
 *         loop_prep, doc, default_casting=default_casting, out_ops=_out_ops,
 *         cutensor_op=cutensor_op, scatter_op=scatter_op)
*/
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_ops_->nin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_ops_->nout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "cupy/_core/_kernel.pyx":1766
 *         name, ops_.nin, ops_.nout, ops_, preamble,
 *         loop_prep, doc, default_casting=default_casting, out_ops=_out_ops,
 *         cutensor_op=cutensor_op, scatter_op=scatter_op)             # <<<<<<<<<<<<<<
*/
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[8 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_4, __pyx_v_name, __pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_ops_), __pyx_v_preamble, __pyx_v_loop_prep, __pyx_v_doc};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_default_casting, __pyx_v_default_casting, __pyx_t_8, __pyx_callargs+8, 0) < (0)) __PYX_ERR(0, 1763, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_out_ops, __pyx_v__out_ops, __pyx_t_8, __pyx_callargs+8, 1) < (0)) __PYX_ERR(0, 1763, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cutensor_op, __pyx_v_cutensor_op, __pyx_t_8, __pyx_callargs+8, 2) < (0)) __PYX_ERR(0, 1763, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_scatter_op, __pyx_v_scatter_op, __pyx_t_8, __pyx_callargs+8, 3) < (0)) __PYX_ERR(0, 1763, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ufunc, __pyx_callargs+__pyx_t_7, (8-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1763, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/_core/_kernel.pyx":1756
 * 
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',             # <<<<<<<<<<<<<<
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cupy._core._kernel.create_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ops_);
  __Pyx_XDECREF(__pyx_v__out_ops);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_19create_ufunc(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_18create_ufunc, "create_ufunc(name, ops, routine=None, preamble='', doc='', default_casting=None, loop_prep='', out_ops=None, cutensor_op=None, scatter_op=None, promote_types=None)");
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_19create_ufunc(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_ops = 0;
  PyObject *__pyx_v_routine = 0;
  PyObject *__pyx_v_preamble = 0;
  PyObject *__pyx_v_doc = 0;
  PyObject *__pyx_v_default_casting = 0;
  PyObject *__pyx_v_loop_prep = 0;
  PyObject *__pyx_v_out_ops = 0;
  PyObject *__pyx_v_cutensor_op = 0;
  PyObject *__pyx_v_scatter_op = 0;
  PyObject *__pyx_v_promote_types = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_ufunc (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,&__pyx_mstate_global->__pyx_n_u_ops,&__pyx_mstate_global->__pyx_n_u_routine,&__pyx_mstate_global->__pyx_n_u_preamble,&__pyx_mstate_global->__pyx_n_u_doc,&__pyx_mstate_global->__pyx_n_u_default_casting,&__pyx_mstate_global->__pyx_n_u_loop_prep,&__pyx_mstate_global->__pyx_n_u_out_ops,&__pyx_mstate_global->__pyx_n_u_cutensor_op,&__pyx_mstate_global->__pyx_n_u_scatter_op,&__pyx_mstate_global->__pyx_n_u_promote_types,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1756, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "create_ufunc", 0) < (0)) __PYX_ERR(0, 1756, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":1757
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,             # <<<<<<<<<<<<<<
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1758
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,             # <<<<<<<<<<<<<<
 *                    promote_types=None):
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1759
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):             # <<<<<<<<<<<<<<
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("create_ufunc", 0, 2, 11, i); __PYX_ERR(0, 1756, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1756, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1756, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1756, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "cupy/_core/_kernel.pyx":1756
 * 
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',             # <<<<<<<<<<<<<<
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));

      /* "cupy/_core/_kernel.pyx":1757
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,             # <<<<<<<<<<<<<<
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1758
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,             # <<<<<<<<<<<<<<
 *                    promote_types=None):
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "cupy/_core/_kernel.pyx":1759
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
 *                    promote_types=None):             # <<<<<<<<<<<<<<
 *     ops_ = _Ops.from_tuples(ops, routine, promote_types)
 *     _out_ops = None if out_ops is None else _Ops.from_tuples(
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_name = values[0];
    __pyx_v_ops = values[1];
    __pyx_v_routine = values[2];
    __pyx_v_preamble = values[3];
    __pyx_v_doc = values[4];
    __pyx_v_default_casting = values[5];
    __pyx_v_loop_prep = values[6];
    __pyx_v_out_ops = values[7];
    __pyx_v_cutensor_op = values[8];
    __pyx_v_scatter_op = values[9];
    __pyx_v_promote_types = values[10];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_ufunc", 0, 2, 11, __pyx_nargs); __PYX_ERR(0, 1756, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.create_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_18create_ufunc(__pyx_self, __pyx_v_name, __pyx_v_ops, __pyx_v_routine, __pyx_v_preamble, __pyx_v_doc, __pyx_v_default_casting, __pyx_v_loop_prep, __pyx_v_out_ops, __pyx_v_cutensor_op, __pyx_v_scatter_op, __pyx_v_promote_types);

  /* "cupy/_core/_kernel.pyx":1756
 * 
 * 
 * cpdef create_ufunc(name, ops, routine=None, preamble='', doc='',             # <<<<<<<<<<<<<<
 *                    default_casting=None, loop_prep='', out_ops=None,
 *                    cutensor_op=None, scatter_op=None,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_18create_ufunc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_ops, PyObject *__pyx_v_routine, PyObject *__pyx_v_preamble, PyObject *__pyx_v_doc, PyObject *__pyx_v_default_casting, PyObject *__pyx_v_loop_prep, PyObject *__pyx_v_out_ops, PyObject *__pyx_v_cutensor_op, PyObject *__pyx_v_scatter_op, PyObject *__pyx_v_promote_types) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_ufunc", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 9;
  __pyx_t_2.routine = __pyx_v_routine;
  __pyx_t_2.preamble = __pyx_v_preamble;
  __pyx_t_2.doc = __pyx_v_doc;
  __pyx_t_2.default_casting = __pyx_v_default_casting;
  __pyx_t_2.loop_prep = __pyx_v_loop_prep;
  __pyx_t_2.out_ops = __pyx_v_out_ops;
  __pyx_t_2.cutensor_op = __pyx_v_cutensor_op;
  __pyx_t_2.scatter_op = __pyx_v_scatter_op;
  __pyx_t_2.promote_types = __pyx_v_promote_types;
  __pyx_t_1 = __pyx_f_4cupy_5_core_7_kernel_create_ufunc(__pyx_v_name, __pyx_v_ops, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.create_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__ArgInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_21__pyx_unpickle__ArgInfo(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_20__pyx_unpickle__ArgInfo, "__pyx_unpickle__ArgInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_21__pyx_unpickle__ArgInfo = {"__pyx_unpickle__ArgInfo", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_21__pyx_unpickle__ArgInfo, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_20__pyx_unpickle__ArgInfo};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_21__pyx_unpickle__ArgInfo(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__ArgInfo (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle__ArgInfo", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__ArgInfo", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__ArgInfo", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__ArgInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_20__pyx_unpickle__ArgInfo(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_20__pyx_unpickle__ArgInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ArgInfo", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle__ArgInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')             # <<<<<<<<<<<<<<
 *     __pyx_result = _ArgInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, __pyx_k_arg_kind_c_contiguous_dtype_inde); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
 *     __pyx_result = _ArgInfo.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
 *     __pyx_result = _ArgInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = _ArgInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__ArgInfo__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
 *     __pyx_result = _ArgInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.arg_kind = __pyx_state[0]; __pyx_result.c_contiguous = __pyx_state[1]; __pyx_result.dtype = __pyx_state[2]; __pyx_result.index_32_bits = __pyx_state[3]; __pyx_result.ndim = __pyx_state[4]; __pyx_result.type = __pyx_state[5]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__ArgInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__ArgInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.arg_kind = __pyx_state[0]; __pyx_result.c_contiguous = __pyx_state[1]; __pyx_result.dtype = __pyx_state[2]; __pyx_result.index_32_bits = __pyx_state[3]; __pyx_result.ndim = __pyx_state[4]; __pyx_result.type = __pyx_state[5]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 6)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__ArgInfo__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__ArgInfo__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.arg_kind = __pyx_state[0]; __pyx_result.c_contiguous = __pyx_state[1]; __pyx_result.dtype = __pyx_state[2]; __pyx_result.index_32_bits = __pyx_state[3]; __pyx_result.ndim = __pyx_state[4]; __pyx_result.type = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 6)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)__Pyx_PyLong_As_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->arg_kind = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->c_contiguous = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->dtype);
  __Pyx_DECREF(__pyx_v___pyx_result->dtype);
  __pyx_v___pyx_result->dtype = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->index_32_bits = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->ndim = __pyx_t_4;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyType_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->type);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->type);
  __pyx_v___pyx_result->type = ((PyTypeObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.arg_kind = __pyx_state[0]; __pyx_result.c_contiguous = __pyx_state[1]; __pyx_result.dtype = __pyx_state[2]; __pyx_result.index_32_bits = __pyx_state[3]; __pyx_result.ndim = __pyx_state[4]; __pyx_result.type = __pyx_state[5]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 6)             # <<<<<<<<<<<<<<
*/
  __pyx_t_4 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 6); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle__ArgInfo__set_state(<_ArgInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__ArgInfo__set_state(_ArgInfo __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.arg_kind = __pyx_state[0]; __pyx_result.c_contiguous = __pyx_state[1]; __pyx_result.dtype = __pyx_state[2]; __pyx_result.index_32_bits = __pyx_state[3]; __pyx_result.ndim = __pyx_state[4]; __pyx_result.type = __pyx_state[5]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 6)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__ArgInfo__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ParameterInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_23__pyx_unpickle_ParameterInfo(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_22__pyx_unpickle_ParameterInfo, "__pyx_unpickle_ParameterInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_23__pyx_unpickle_ParameterInfo = {"__pyx_unpickle_ParameterInfo", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_23__pyx_unpickle_ParameterInfo, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_22__pyx_unpickle_ParameterInfo};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_23__pyx_unpickle_ParameterInfo(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ParameterInfo (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_ParameterInfo", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ParameterInfo", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ParameterInfo", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ParameterInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_22__pyx_unpickle_ParameterInfo(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_22__pyx_unpickle_ParameterInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ParameterInfo", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_ParameterInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')             # <<<<<<<<<<<<<<
 *     __pyx_result = ParameterInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, __pyx_k_ctype_dtype_is_const_name_raw); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')
 *     __pyx_result = ParameterInfo.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')
 *     __pyx_result = ParameterInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = ParameterInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ParameterInfo__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')
 *     __pyx_result = ParameterInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.ctype = __pyx_state[0]; __pyx_result.dtype = __pyx_state[1]; __pyx_result.is_const = __pyx_state[2]; __pyx_result.name = __pyx_state[3]; __pyx_result.raw = __pyx_state[4]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ParameterInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x10a6dc8, 0x01aaef5, 0x73694c8, b'ctype, dtype, is_const, name, raw')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ParameterInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.ctype = __pyx_state[0]; __pyx_result.dtype = __pyx_state[1]; __pyx_result.is_const = __pyx_state[2]; __pyx_result.name = __pyx_state[3]; __pyx_result.raw = __pyx_state[4]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ParameterInfo__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ParameterInfo__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.ctype = __pyx_state[0]; __pyx_result.dtype = __pyx_state[1]; __pyx_result.is_const = __pyx_state[2]; __pyx_result.name = __pyx_state[3]; __pyx_result.raw = __pyx_state[4]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->ctype);
  __Pyx_DECREF(__pyx_v___pyx_result->ctype);
  __pyx_v___pyx_result->ctype = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->dtype);
  __Pyx_DECREF(__pyx_v___pyx_result->dtype);
  __pyx_v___pyx_result->dtype = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->is_const = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->raw = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):
 *     __pyx_result.ctype = __pyx_state[0]; __pyx_result.dtype = __pyx_state[1]; __pyx_result.is_const = __pyx_state[2]; __pyx_result.name = __pyx_state[3]; __pyx_result.raw = __pyx_state[4]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5)             # <<<<<<<<<<<<<<
*/
  __pyx_t_3 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 5); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_ParameterInfo__set_state(<ParameterInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ParameterInfo__set_state(ParameterInfo __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.ctype = __pyx_state[0]; __pyx_result.dtype = __pyx_state[1]; __pyx_result.is_const = __pyx_state[2]; __pyx_result.name = __pyx_state[3]; __pyx_result.raw = __pyx_state[4]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ParameterInfo__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__TypeMap(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_25__pyx_unpickle__TypeMap(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_24__pyx_unpickle__TypeMap, "__pyx_unpickle__TypeMap(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_25__pyx_unpickle__TypeMap = {"__pyx_unpickle__TypeMap", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_25__pyx_unpickle__TypeMap, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_24__pyx_unpickle__TypeMap};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_25__pyx_unpickle__TypeMap(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__TypeMap (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle__TypeMap", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__TypeMap", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__TypeMap", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__TypeMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_24__pyx_unpickle__TypeMap(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_24__pyx_unpickle__TypeMap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__TypeMap", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle__TypeMap(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')             # <<<<<<<<<<<<<<
 *     __pyx_result = _TypeMap.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, __pyx_k_pairs_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
 *     __pyx_result = _TypeMap.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
 *     __pyx_result = _TypeMap.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = _TypeMap.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__TypeMap__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
 *     __pyx_result = _TypeMap.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):
 *     __pyx_result._pairs = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__TypeMap(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__TypeMap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result._pairs = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__TypeMap__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__TypeMap__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):
 *     __pyx_result._pairs = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_pairs);
  __Pyx_DECREF(__pyx_v___pyx_result->_pairs);
  __pyx_v___pyx_result->_pairs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):
 *     __pyx_result._pairs = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle__TypeMap__set_state(<_TypeMap> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__TypeMap__set_state(_TypeMap __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result._pairs = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__TypeMap__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ElementwiseKernel(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_27__pyx_unpickle_ElementwiseKernel(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_26__pyx_unpickle_ElementwiseKernel, "__pyx_unpickle_ElementwiseKernel(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_27__pyx_unpickle_ElementwiseKernel = {"__pyx_unpickle_ElementwiseKernel", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_27__pyx_unpickle_ElementwiseKernel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_26__pyx_unpickle_ElementwiseKernel};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_27__pyx_unpickle_ElementwiseKernel(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ElementwiseKernel (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_ElementwiseKernel", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementwiseKernel", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementwiseKernel", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ElementwiseKernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_26__pyx_unpickle_ElementwiseKernel(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_26__pyx_unpickle_ElementwiseKernel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ElementwiseKernel", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_ElementwiseKernel(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')             # <<<<<<<<<<<<<<
 *     __pyx_result = ElementwiseKernel.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, __pyx_k_name____cached_codes__elementw); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')
 *     __pyx_result = ElementwiseKernel.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')
 *     __pyx_result = ElementwiseKernel.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = ElementwiseKernel.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ElementwiseKernel__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')
 *     __pyx_result = ElementwiseKernel.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__name__ = __pyx_state[0]; __pyx_result._cached_codes = __pyx_state[1]; __pyx_result._elementwise_kernel_memo = __pyx_state[2]; __pyx_result._params_type_memo = __pyx_state[3]; __pyx_result.in_params = __pyx_state[4]; __pyx_result.kwargs = __pyx_state[5]; __pyx_result.name = __pyx_state[6]; __pyx_result.nargs = __pyx_state[7]; __pyx_result.nin = __pyx_state[8]; __pyx_result.no_return = __pyx_state[9]; __pyx_result.nout = __pyx_state[10]; __pyx_result.operation = __pyx_state[11]; __pyx_result.out_params = __pyx_state[12]; __pyx_result.params = __pyx_state[13]; __pyx_result.preamble = __pyx_state[14]; __pyx_result.reduce_dims = __pyx_state[15]; __pyx_result.return_tuple = __pyx_state[16]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ElementwiseKernel(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x7ba2f73, 0x9d0b3b6, 0x9c5005e, b'__name__, _cached_codes, _elementwise_kernel_memo, _params_type_memo, in_params, kwargs, name, nargs, nin, no_return, nout, operation, out_params, params, preamble, reduce_dims, return_tuple')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ElementwiseKernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.__name__ = __pyx_state[0]; __pyx_result._cached_codes = __pyx_state[1]; __pyx_result._elementwise_kernel_memo = __pyx_state[2]; __pyx_result._params_type_memo = __pyx_state[3]; __pyx_result.in_params = __pyx_state[4]; __pyx_result.kwargs = __pyx_state[5]; __pyx_result.name = __pyx_state[6]; __pyx_result.nargs = __pyx_state[7]; __pyx_result.nin = __pyx_state[8]; __pyx_result.no_return = __pyx_state[9]; __pyx_result.nout = __pyx_state[10]; __pyx_result.operation = __pyx_state[11]; __pyx_result.out_params = __pyx_state[12]; __pyx_result.params = __pyx_state[13]; __pyx_result.preamble = __pyx_state[14]; __pyx_result.reduce_dims = __pyx_state[15]; __pyx_result.return_tuple = __pyx_state[16]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 17)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ElementwiseKernel__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ElementwiseKernel__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__name__ = __pyx_state[0]; __pyx_result._cached_codes = __pyx_state[1]; __pyx_result._elementwise_kernel_memo = __pyx_state[2]; __pyx_result._params_type_memo = __pyx_state[3]; __pyx_result.in_params = __pyx_state[4]; __pyx_result.kwargs = __pyx_state[5]; __pyx_result.name = __pyx_state[6]; __pyx_result.nargs = __pyx_state[7]; __pyx_result.nin = __pyx_state[8]; __pyx_result.no_return = __pyx_state[9]; __pyx_result.nout = __pyx_state[10]; __pyx_result.operation = __pyx_state[11]; __pyx_result.out_params = __pyx_state[12]; __pyx_result.params = __pyx_state[13]; __pyx_result.preamble = __pyx_state[14]; __pyx_result.reduce_dims = __pyx_state[15]; __pyx_result.return_tuple = __pyx_state[16]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 17)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx___name__);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx___name__);
  __pyx_v___pyx_result->__pyx___name__ = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_cached_codes);
  __Pyx_DECREF(__pyx_v___pyx_result->_cached_codes);
  __pyx_v___pyx_result->_cached_codes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_elementwise_kernel_memo);
  __Pyx_DECREF(__pyx_v___pyx_result->_elementwise_kernel_memo);
  __pyx_v___pyx_result->_elementwise_kernel_memo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_params_type_memo);
  __Pyx_DECREF(__pyx_v___pyx_result->_params_type_memo);
  __pyx_v___pyx_result->_params_type_memo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->in_params);
  __Pyx_DECREF(__pyx_v___pyx_result->in_params);
  __pyx_v___pyx_result->in_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->kwargs);
  __Pyx_DECREF(__pyx_v___pyx_result->kwargs);
  __pyx_v___pyx_result->kwargs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nargs = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nin = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->no_return = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nout = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->operation);
  __Pyx_DECREF(__pyx_v___pyx_result->operation);
  __pyx_v___pyx_result->operation = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->out_params);
  __Pyx_DECREF(__pyx_v___pyx_result->out_params);
  __pyx_v___pyx_result->out_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->params);
  __Pyx_DECREF(__pyx_v___pyx_result->params);
  __pyx_v___pyx_result->params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->preamble);
  __Pyx_DECREF(__pyx_v___pyx_result->preamble);
  __pyx_v___pyx_result->preamble = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->reduce_dims = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->return_tuple = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__name__ = __pyx_state[0]; __pyx_result._cached_codes = __pyx_state[1]; __pyx_result._elementwise_kernel_memo = __pyx_state[2]; __pyx_result._params_type_memo = __pyx_state[3]; __pyx_result.in_params = __pyx_state[4]; __pyx_result.kwargs = __pyx_state[5]; __pyx_result.name = __pyx_state[6]; __pyx_result.nargs = __pyx_state[7]; __pyx_result.nin = __pyx_state[8]; __pyx_result.no_return = __pyx_state[9]; __pyx_result.nout = __pyx_state[10]; __pyx_result.operation = __pyx_state[11]; __pyx_result.out_params = __pyx_state[12]; __pyx_result.params = __pyx_state[13]; __pyx_result.preamble = __pyx_state[14]; __pyx_result.reduce_dims = __pyx_state[15]; __pyx_result.return_tuple = __pyx_state[16]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 17)             # <<<<<<<<<<<<<<
*/
  __pyx_t_4 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 17); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_ElementwiseKernel__set_state(<ElementwiseKernel> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ElementwiseKernel__set_state(ElementwiseKernel __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.__name__ = __pyx_state[0]; __pyx_result._cached_codes = __pyx_state[1]; __pyx_result._elementwise_kernel_memo = __pyx_state[2]; __pyx_result._params_type_memo = __pyx_state[3]; __pyx_result.in_params = __pyx_state[4]; __pyx_result.kwargs = __pyx_state[5]; __pyx_result.name = __pyx_state[6]; __pyx_result.nargs = __pyx_state[7]; __pyx_result.nin = __pyx_state[8]; __pyx_result.no_return = __pyx_state[9]; __pyx_result.nout = __pyx_state[10]; __pyx_result.operation = __pyx_state[11]; __pyx_result.out_params = __pyx_state[12]; __pyx_result.params = __pyx_state[13]; __pyx_result.preamble = __pyx_state[14]; __pyx_result.reduce_dims = __pyx_state[15]; __pyx_result.return_tuple = __pyx_state[16]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 17)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ElementwiseKernel__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ufunc(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_29__pyx_unpickle_ufunc(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_28__pyx_unpickle_ufunc, "__pyx_unpickle_ufunc(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_29__pyx_unpickle_ufunc = {"__pyx_unpickle_ufunc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_29__pyx_unpickle_ufunc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_28__pyx_unpickle_ufunc};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_29__pyx_unpickle_ufunc(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ufunc (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_ufunc", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ufunc", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ufunc", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_28__pyx_unpickle_ufunc(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_28__pyx_unpickle_ufunc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ufunc", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_ufunc(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')             # <<<<<<<<<<<<<<
 *     __pyx_result = ufunc.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, __pyx_k_doc_____name____cutensor_alpha); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
 *     __pyx_result = ufunc.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel_ufunc);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
 *     __pyx_result = ufunc.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = ufunc.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ufunc__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
 *     __pyx_result = ufunc.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__doc__ = __pyx_state[0]; __pyx_result.__name__ = __pyx_state[1]; __pyx_result._cutensor_alpha = __pyx_state[2]; __pyx_result._cutensor_gamma = __pyx_state[3]; __pyx_result._cutensor_op = __pyx_state[4]; __pyx_result._default_casting = __pyx_state[5]; __pyx_result._doc = __pyx_state[6]; __pyx_result._kernel_memo = __pyx_state[7]; __pyx_result._loop_prep = __pyx_state[8]; __pyx_result._ops = __pyx_state[9]; __pyx_result._out_ops = __pyx_state[10]; __pyx_result._params = __pyx_state[11]; __pyx_result._params_with_where = __pyx_state[12]; __pyx_result._preamble = __pyx_state[13]; __pyx_result._routine_cache = __pyx_state[14]; __pyx_result._scatter_op = __pyx_state[15]; __pyx_result.name = __pyx_state[16]; __pyx_result.nargs = __pyx_state[17]; __pyx_result.nin = __pyx_state[18]; __pyx_result.nout = __pyx_state[19]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ufunc(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.__doc__ = __pyx_state[0]; __pyx_result.__name__ = __pyx_state[1]; __pyx_result._cutensor_alpha = __pyx_state[2]; __pyx_result._cutensor_gamma = __pyx_state[3]; __pyx_result._cutensor_op = __pyx_state[4]; __pyx_result._default_casting = __pyx_state[5]; __pyx_result._doc = __pyx_state[6]; __pyx_result._kernel_memo = __pyx_state[7]; __pyx_result._loop_prep = __pyx_state[8]; __pyx_result._ops = __pyx_state[9]; __pyx_result._out_ops = __pyx_state[10]; __pyx_result._params = __pyx_state[11]; __pyx_result._params_with_where = __pyx_state[12]; __pyx_result._preamble = __pyx_state[13]; __pyx_result._routine_cache = __pyx_state[14]; __pyx_result._scatter_op = __pyx_state[15]; __pyx_result.name = __pyx_state[16]; __pyx_result.nargs = __pyx_state[17]; __pyx_result.nin = __pyx_state[18]; __pyx_result.nout = __pyx_state[19]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 20)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle_ufunc__set_state(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ufunc__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__doc__ = __pyx_state[0]; __pyx_result.__name__ = __pyx_state[1]; __pyx_result._cutensor_alpha = __pyx_state[2]; __pyx_result._cutensor_gamma = __pyx_state[3]; __pyx_result._cutensor_op = __pyx_state[4]; __pyx_result._default_casting = __pyx_state[5]; __pyx_result._doc = __pyx_state[6]; __pyx_result._kernel_memo = __pyx_state[7]; __pyx_result._loop_prep = __pyx_state[8]; __pyx_result._ops = __pyx_state[9]; __pyx_result._out_ops = __pyx_state[10]; __pyx_result._params = __pyx_state[11]; __pyx_result._params_with_where = __pyx_state[12]; __pyx_result._preamble = __pyx_state[13]; __pyx_result._routine_cache = __pyx_state[14]; __pyx_result._scatter_op = __pyx_state[15]; __pyx_result.name = __pyx_state[16]; __pyx_result.nargs = __pyx_state[17]; __pyx_result.nin = __pyx_state[18]; __pyx_result.nout = __pyx_state[19]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 20)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx___doc__);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx___doc__);
  __pyx_v___pyx_result->__pyx___doc__ = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->__pyx___name__);
  __Pyx_DECREF(__pyx_v___pyx_result->__pyx___name__);
  __pyx_v___pyx_result->__pyx___name__ = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_cutensor_alpha = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->_cutensor_gamma = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_cutensor_op);
  __Pyx_DECREF(__pyx_v___pyx_result->_cutensor_op);
  __pyx_v___pyx_result->_cutensor_op = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_default_casting);
  __Pyx_DECREF(__pyx_v___pyx_result->_default_casting);
  __pyx_v___pyx_result->_default_casting = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_doc);
  __Pyx_DECREF(__pyx_v___pyx_result->_doc);
  __pyx_v___pyx_result->_doc = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_kernel_memo);
  __Pyx_DECREF(__pyx_v___pyx_result->_kernel_memo);
  __pyx_v___pyx_result->_kernel_memo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_loop_prep);
  __Pyx_DECREF(__pyx_v___pyx_result->_loop_prep);
  __pyx_v___pyx_result->_loop_prep = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops))))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_ops);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_ops);
  __pyx_v___pyx_result->_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops))))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_out_ops);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_out_ops);
  __pyx_v___pyx_result->_out_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_params);
  __Pyx_DECREF(__pyx_v___pyx_result->_params);
  __pyx_v___pyx_result->_params = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_params_with_where);
  __Pyx_DECREF(__pyx_v___pyx_result->_params_with_where);
  __pyx_v___pyx_result->_params_with_where = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_preamble);
  __Pyx_DECREF(__pyx_v___pyx_result->_preamble);
  __pyx_v___pyx_result->_preamble = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_routine_cache);
  __Pyx_DECREF(__pyx_v___pyx_result->_routine_cache);
  __pyx_v___pyx_result->_routine_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_scatter_op);
  __Pyx_DECREF(__pyx_v___pyx_result->_scatter_op);
  __pyx_v___pyx_result->_scatter_op = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nargs = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nin = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nout = __pyx_t_3;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):
 *     __pyx_result.__doc__ = __pyx_state[0]; __pyx_result.__name__ = __pyx_state[1]; __pyx_result._cutensor_alpha = __pyx_state[2]; __pyx_result._cutensor_gamma = __pyx_state[3]; __pyx_result._cutensor_op = __pyx_state[4]; __pyx_result._default_casting = __pyx_state[5]; __pyx_result._doc = __pyx_state[6]; __pyx_result._kernel_memo = __pyx_state[7]; __pyx_result._loop_prep = __pyx_state[8]; __pyx_result._ops = __pyx_state[9]; __pyx_result._out_ops = __pyx_state[10]; __pyx_result._params = __pyx_state[11]; __pyx_result._params_with_where = __pyx_state[12]; __pyx_result._preamble = __pyx_state[13]; __pyx_result._routine_cache = __pyx_state[14]; __pyx_result._scatter_op = __pyx_state[15]; __pyx_result.name = __pyx_state[16]; __pyx_result.nargs = __pyx_state[17]; __pyx_result.nin = __pyx_state[18]; __pyx_result.nout = __pyx_state[19]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 20)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 20); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_ufunc__set_state(<ufunc> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ufunc__set_state(ufunc __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.__doc__ = __pyx_state[0]; __pyx_result.__name__ = __pyx_state[1]; __pyx_result._cutensor_alpha = __pyx_state[2]; __pyx_result._cutensor_gamma = __pyx_state[3]; __pyx_result._cutensor_op = __pyx_state[4]; __pyx_result._default_casting = __pyx_state[5]; __pyx_result._doc = __pyx_state[6]; __pyx_result._kernel_memo = __pyx_state[7]; __pyx_result._loop_prep = __pyx_state[8]; __pyx_result._ops = __pyx_state[9]; __pyx_result._out_ops = __pyx_state[10]; __pyx_result._params = __pyx_state[11]; __pyx_result._params_with_where = __pyx_state[12]; __pyx_result._preamble = __pyx_state[13]; __pyx_result._routine_cache = __pyx_state[14]; __pyx_result._scatter_op = __pyx_state[15]; __pyx_result.name = __pyx_state[16]; __pyx_result.nargs = __pyx_state[17]; __pyx_result.nin = __pyx_state[18]; __pyx_result.nout = __pyx_state[19]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 20)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle_ufunc__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__Op(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_31__pyx_unpickle__Op(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_30__pyx_unpickle__Op, "__pyx_unpickle__Op(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_31__pyx_unpickle__Op = {"__pyx_unpickle__Op", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_31__pyx_unpickle__Op, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_30__pyx_unpickle__Op};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_31__pyx_unpickle__Op(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__Op (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle__Op", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Op", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Op", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_30__pyx_unpickle__Op(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_30__pyx_unpickle__Op(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__Op", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle__Op(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')             # <<<<<<<<<<<<<<
 *     __pyx_result = _Op.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, __pyx_k_in_dtypes__out_dtypes__resoluti); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')
 *     __pyx_result = _Op.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Op);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')
 *     __pyx_result = _Op.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = _Op.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Op__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')
 *     __pyx_result = _Op.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):
 *     __pyx_result._in_dtypes = __pyx_state[0]; __pyx_result._out_dtypes = __pyx_state[1]; __pyx_result._resolution_func = __pyx_state[2]; __pyx_result.error_func = __pyx_state[3]; __pyx_result.in_types = __pyx_state[4]; __pyx_result.nin = __pyx_state[5]; __pyx_result.nout = __pyx_state[6]; __pyx_result.out_types = __pyx_state[7]; __pyx_result.routine = __pyx_state[8]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__Op(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xfc654c8, 0x03931fc, 0xcda3d45, b'_in_dtypes, _out_dtypes, _resolution_func, error_func, in_types, nin, nout, out_types, routine')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result._in_dtypes = __pyx_state[0]; __pyx_result._out_dtypes = __pyx_state[1]; __pyx_result._resolution_func = __pyx_state[2]; __pyx_result.error_func = __pyx_state[3]; __pyx_result.in_types = __pyx_state[4]; __pyx_result.nin = __pyx_state[5]; __pyx_result.nout = __pyx_state[6]; __pyx_result.out_types = __pyx_state[7]; __pyx_result.routine = __pyx_state[8]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 9)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Op__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__Op *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__Op__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):
 *     __pyx_result._in_dtypes = __pyx_state[0]; __pyx_result._out_dtypes = __pyx_state[1]; __pyx_result._resolution_func = __pyx_state[2]; __pyx_result.error_func = __pyx_state[3]; __pyx_result.in_types = __pyx_state[4]; __pyx_result.nin = __pyx_state[5]; __pyx_result.nout = __pyx_state[6]; __pyx_result.out_types = __pyx_state[7]; __pyx_result.routine = __pyx_state[8]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 9)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_in_dtypes);
  __Pyx_DECREF(__pyx_v___pyx_result->_in_dtypes);
  __pyx_v___pyx_result->_in_dtypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_out_dtypes);
  __Pyx_DECREF(__pyx_v___pyx_result->_out_dtypes);
  __pyx_v___pyx_result->_out_dtypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->_resolution_func);
  __Pyx_DECREF(__pyx_v___pyx_result->_resolution_func);
  __pyx_v___pyx_result->_resolution_func = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->error_func);
  __Pyx_DECREF(__pyx_v___pyx_result->error_func);
  __pyx_v___pyx_result->error_func = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->in_types);
  __Pyx_DECREF(__pyx_v___pyx_result->in_types);
  __pyx_v___pyx_result->in_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nin = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nout = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->out_types);
  __Pyx_DECREF(__pyx_v___pyx_result->out_types);
  __pyx_v___pyx_result->out_types = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->routine);
  __Pyx_DECREF(__pyx_v___pyx_result->routine);
  __pyx_v___pyx_result->routine = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):
 *     __pyx_result._in_dtypes = __pyx_state[0]; __pyx_result._out_dtypes = __pyx_state[1]; __pyx_result._resolution_func = __pyx_state[2]; __pyx_result.error_func = __pyx_state[3]; __pyx_result.in_types = __pyx_state[4]; __pyx_result.nin = __pyx_state[5]; __pyx_result.nout = __pyx_state[6]; __pyx_result.out_types = __pyx_state[7]; __pyx_result.routine = __pyx_state[8]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 9)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 9); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle__Op__set_state(<_Op> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__Op__set_state(_Op __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result._in_dtypes = __pyx_state[0]; __pyx_result._out_dtypes = __pyx_state[1]; __pyx_result._resolution_func = __pyx_state[2]; __pyx_result.error_func = __pyx_state[3]; __pyx_result.in_types = __pyx_state[4]; __pyx_result.nin = __pyx_state[5]; __pyx_result.nout = __pyx_state[6]; __pyx_result.out_types = __pyx_state[7]; __pyx_result.routine = __pyx_state[8]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 9)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Op__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__Ops(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
*/

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_33__pyx_unpickle__Ops(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_4cupy_5_core_7_kernel_32__pyx_unpickle__Ops, "__pyx_unpickle__Ops(__pyx_type, long __pyx_checksum, tuple __pyx_state)");
static PyMethodDef __pyx_mdef_4cupy_5_core_7_kernel_33__pyx_unpickle__Ops = {"__pyx_unpickle__Ops", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_33__pyx_unpickle__Ops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_32__pyx_unpickle__Ops};
static PyObject *__pyx_pw_4cupy_5_core_7_kernel_33__pyx_unpickle__Ops(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle__Ops (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(7, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle__Ops", 0) < (0)) __PYX_ERR(7, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Ops", 1, 3, 3, i); __PYX_ERR(7, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(7, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(7, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(7, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Ops", 1, 3, 3, __pyx_nargs); __PYX_ERR(7, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Ops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(7, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_4cupy_5_core_7_kernel_32__pyx_unpickle__Ops(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4cupy_5_core_7_kernel_32__pyx_unpickle__Ops(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__Ops", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle__Ops(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')             # <<<<<<<<<<<<<<
 *     __pyx_result = _Ops.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, __pyx_k_nin_nout_ops_promote_types); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(7, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
 *     __pyx_result = _Ops.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel__Ops);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
 *     __pyx_result = _Ops.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = _Ops.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(7, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Ops__set_state(((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
 *     __pyx_result = _Ops.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):
 *     __pyx_result.nin = __pyx_state[0]; __pyx_result.nout = __pyx_state[1]; __pyx_result.ops = __pyx_state[2]; __pyx_result.promote_types = __pyx_state[3]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__Ops(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Ops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.nin = __pyx_state[0]; __pyx_result.nout = __pyx_state[1]; __pyx_result.ops = __pyx_state[2]; __pyx_result.promote_types = __pyx_state[3]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 4)
*/

static PyObject *__pyx_f_4cupy_5_core_7_kernel___pyx_unpickle__Ops__set_state(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle__Ops__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):
 *     __pyx_result.nin = __pyx_state[0]; __pyx_result.nout = __pyx_state[1]; __pyx_result.ops = __pyx_state[2]; __pyx_result.promote_types = __pyx_state[3]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 4)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nin = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->nout = __pyx_t_2;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->ops);
  __Pyx_DECREF(__pyx_v___pyx_result->ops);
  __pyx_v___pyx_result->ops = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->promote_types);
  __Pyx_DECREF(__pyx_v___pyx_result->promote_types);
  __pyx_v___pyx_result->promote_types = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):
 *     __pyx_result.nin = __pyx_state[0]; __pyx_result.nout = __pyx_state[1]; __pyx_result.ops = __pyx_state[2]; __pyx_result.promote_types = __pyx_state[3]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 4)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(7, 13, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle__Ops__set_state(<_Ops> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle__Ops__set_state(_Ops __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.nin = __pyx_state[0]; __pyx_result.nout = __pyx_state[1]; __pyx_result.ops = __pyx_state[2]; __pyx_result.promote_types = __pyx_state[3]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 4)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy._core._kernel.__pyx_unpickle__Ops__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ParameterInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)o);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->dtype = Py_None; Py_INCREF(Py_None);
  p->ctype = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel_ParameterInfo(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel_ParameterInfo) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->dtype);
  Py_CLEAR(p->ctype);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel_ParameterInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->dtype) {
    e = (*v)(p->dtype, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel_ParameterInfo(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *)o;
  tmp = ((PyObject*)p->dtype);
  p->dtype = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_4cupy_5_core_7_kernel_ParameterInfo(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_dtype(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5dtype_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_ctype(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_5ctype_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_raw(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3raw_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_is_const(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_8is_const_1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel_ParameterInfo[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_13ParameterInfo_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_13ParameterInfo_10__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel_ParameterInfo[] = {
  {"name", __pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_name, 0, 0, 0},
  {"dtype", __pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_dtype, 0, 0, 0},
  {"ctype", __pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_ctype, 0, 0, 0},
  {"raw", __pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_raw, 0, 0, 0},
  {"is_const", __pyx_getprop_4cupy_5_core_7_kernel_13ParameterInfo_is_const, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel_ParameterInfo_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_repr, (void *)__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_7__repr__},
  {Py_tp_hash, (void *)__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3__hash__},
  {Py_tp_doc, (void *)PyDoc_STR("ParameterInfo(str param, bool is_const)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel_ParameterInfo},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel_ParameterInfo},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel_ParameterInfo_spec = {
  "cupy._core._kernel.ParameterInfo",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel_ParameterInfo_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel_ParameterInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""ParameterInfo", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel_ParameterInfo, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_3__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ParameterInfo(str param, bool is_const)"), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel_ParameterInfo, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel_ParameterInfo, /*tp_clear*/
  __pyx_tp_richcompare_4cupy_5_core_7_kernel_ParameterInfo, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel_ParameterInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel_ParameterInfo, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_13ParameterInfo_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel_ParameterInfo, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__ArgInfo __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel__ArgInfo;
  p->type = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  p->dtype = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel__ArgInfo(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel__ArgInfo) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->type);
  Py_CLEAR(p->dtype);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel__ArgInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->type) {
    e = (*v)(((PyObject *)p->type), a); if (e) return e;
  }
  if (p->dtype) {
    e = (*v)(p->dtype, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel__ArgInfo(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *p = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *)o;
  tmp = ((PyObject*)p->type);
  p->type = ((PyTypeObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->dtype);
  p->dtype = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_4cupy_5_core_7_kernel__ArgInfo(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_arg_kind(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_8arg_kind_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4type_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_dtype(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_5dtype_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_c_contiguous(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_12c_contiguous_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_index_32_bits(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_13index_32_bits_1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel__ArgInfo[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_8_ArgInfo_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_8_ArgInfo_10__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel__ArgInfo[] = {
  {"arg_kind", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_arg_kind, 0, 0, 0},
  {"type", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_type, 0, 0, 0},
  {"dtype", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_dtype, 0, 0, 0},
  {"ndim", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_ndim, 0, 0, 0},
  {"c_contiguous", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_c_contiguous, 0, 0, 0},
  {"index_32_bits", __pyx_getprop_4cupy_5_core_7_kernel_8_ArgInfo_index_32_bits, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel__ArgInfo_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_repr, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_7__repr__},
  {Py_tp_hash, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_3__hash__},
  {Py_tp_doc, (void *)PyDoc_STR("_ArgInfo(*args)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel__ArgInfo},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel__ArgInfo_spec = {
  "cupy._core._kernel._ArgInfo",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel__ArgInfo_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel__ArgInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""_ArgInfo", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel__ArgInfo, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_3__hash__, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("_ArgInfo(*args)"), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel__ArgInfo, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel__ArgInfo, /*tp_clear*/
  __pyx_tp_richcompare_4cupy_5_core_7_kernel__ArgInfo, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel__ArgInfo, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel__ArgInfo, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_8_ArgInfo_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel__ArgInfo, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__TypeMap __pyx_vtable_4cupy_5_core_7_kernel__TypeMap;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__TypeMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel__TypeMap;
  p->_pairs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel__TypeMap(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *p = (struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel__TypeMap) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_pairs);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel__TypeMap(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *p = (struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_pairs) {
    e = (*v)(p->_pairs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel__TypeMap(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *p = (struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *)o;
  tmp = ((PyObject*)p->_pairs);
  p->_pairs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_tp_richcompare_4cupy_5_core_7_kernel__TypeMap(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_5__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_5__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_8_TypeMap__pairs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_1__get__(o);
}

static int __pyx_setprop_4cupy_5_core_7_kernel_8_TypeMap__pairs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_3__set__(o, v);
  }
  else {
    return __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_6_pairs_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel__TypeMap[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_8_TypeMap_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_8_TypeMap_10__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel__TypeMap[] = {
  {"_pairs", __pyx_getprop_4cupy_5_core_7_kernel_8_TypeMap__pairs, __pyx_setprop_4cupy_5_core_7_kernel_8_TypeMap__pairs, PyDoc_STR("_pairs: tuple"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel__TypeMap_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_hash, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_3__hash__},
  {Py_tp_str, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_7__str__},
  {Py_tp_doc, (void *)PyDoc_STR("_TypeMap(pairs)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel__TypeMap},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel__TypeMap},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel__TypeMap_spec = {
  "cupy._core._kernel._TypeMap",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel__TypeMap_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel__TypeMap = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""_TypeMap", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel__TypeMap, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_3__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("_TypeMap(pairs)"), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel__TypeMap, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel__TypeMap, /*tp_clear*/
  __pyx_tp_richcompare_4cupy_5_core_7_kernel__TypeMap, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel__TypeMap, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel__TypeMap, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_8_TypeMap_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel__TypeMap, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Op __pyx_vtable_4cupy_5_core_7_kernel__Op;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__Op(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel__Op *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel__Op;
  p->in_types = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->out_types = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->routine = Py_None; Py_INCREF(Py_None);
  p->error_func = Py_None; Py_INCREF(Py_None);
  p->_resolution_func = Py_None; Py_INCREF(Py_None);
  p->_in_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_out_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel__Op(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel__Op) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->in_types);
  Py_CLEAR(p->out_types);
  Py_CLEAR(p->routine);
  Py_CLEAR(p->error_func);
  Py_CLEAR(p->_resolution_func);
  Py_CLEAR(p->_in_dtypes);
  Py_CLEAR(p->_out_dtypes);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel__Op(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->in_types) {
    e = (*v)(p->in_types, a); if (e) return e;
  }
  if (p->out_types) {
    e = (*v)(p->out_types, a); if (e) return e;
  }
  if (p->routine) {
    e = (*v)(p->routine, a); if (e) return e;
  }
  if (p->error_func) {
    e = (*v)(p->error_func, a); if (e) return e;
  }
  if (p->_resolution_func) {
    e = (*v)(p->_resolution_func, a); if (e) return e;
  }
  if (p->_in_dtypes) {
    e = (*v)(p->_in_dtypes, a); if (e) return e;
  }
  if (p->_out_dtypes) {
    e = (*v)(p->_out_dtypes, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel__Op(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel__Op *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *)o;
  tmp = ((PyObject*)p->in_types);
  p->in_types = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->out_types);
  p->out_types = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->routine);
  p->routine = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->error_func);
  p->error_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_resolution_func);
  p->_resolution_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_in_dtypes);
  p->_in_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_out_dtypes);
  p->_out_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_in_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_8in_types_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_out_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_9out_types_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_nin(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_3nin_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_nout(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_4nout_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_routine(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_7routine_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op_error_func(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_10error_func_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op__resolution_func(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_16_resolution_func_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op__in_dtypes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_10_in_dtypes_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_3_Op__out_dtypes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_3_Op_11_out_dtypes_1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel__Op[] = {
  {"resolve_dtypes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_3_Op_3resolve_dtypes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_3_Op_2resolve_dtypes},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_3_Op_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_3_Op_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_3_Op_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_3_Op_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel__Op[] = {
  {"in_types", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_in_types, 0, 0, 0},
  {"out_types", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_out_types, 0, 0, 0},
  {"nin", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_nin, 0, 0, 0},
  {"nout", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_nout, 0, 0, 0},
  {"routine", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_routine, 0, 0, 0},
  {"error_func", __pyx_getprop_4cupy_5_core_7_kernel_3_Op_error_func, 0, 0, 0},
  {"_resolution_func", __pyx_getprop_4cupy_5_core_7_kernel_3_Op__resolution_func, 0, 0, 0},
  {"_in_dtypes", __pyx_getprop_4cupy_5_core_7_kernel_3_Op__in_dtypes, 0, 0, 0},
  {"_out_dtypes", __pyx_getprop_4cupy_5_core_7_kernel_3_Op__out_dtypes, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel__Op_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel__Op},
  {Py_tp_repr, (void *)__pyx_pw_4cupy_5_core_7_kernel_3_Op_5__repr__},
  {Py_tp_doc, (void *)PyDoc_STR("_Op(tuple in_types, tuple out_types, routine, error_func, resolution_func)\n\nSimple data structure that represents a kernel routine with single concrete dtype mapping.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel__Op},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel__Op},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel__Op},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel__Op},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_3_Op_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel__Op},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel__Op_spec = {
  "cupy._core._kernel._Op",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__Op),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel__Op_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel__Op = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""_Op", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__Op), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel__Op, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4cupy_5_core_7_kernel_3_Op_5__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("_Op(tuple in_types, tuple out_types, routine, error_func, resolution_func)\n\nSimple data structure that represents a kernel routine with single concrete dtype mapping.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel__Op, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel__Op, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel__Op, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel__Op, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_3_Op_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel__Op, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel__Ops __pyx_vtable_4cupy_5_core_7_kernel__Ops;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel__Ops(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel__Ops;
  p->ops = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->promote_types = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel__Ops(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel__Ops) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->ops);
  Py_CLEAR(p->promote_types);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel__Ops(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->ops) {
    e = (*v)(p->ops, a); if (e) return e;
  }
  if (p->promote_types) {
    e = (*v)(p->promote_types, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel__Ops(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel__Ops *p = (struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)o;
  tmp = ((PyObject*)p->ops);
  p->ops = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->promote_types);
  p->promote_types = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_4_Ops_ops(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_4_Ops_3ops_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_4_Ops_nin(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_4_Ops_3nin_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_4_Ops_nout(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_4_Ops_4nout_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_4_Ops_promote_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_4_Ops_13promote_types_1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel__Ops[] = {
  {"guess_routine", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_3guess_routine, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_4_Ops_2guess_routine},
  {"_guess_routine_from_in_types", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_5_guess_routine_from_in_types, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_4_Ops_4_guess_routine_from_in_types},
  {"_guess_routine_from_dtype", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_7_guess_routine_from_dtype, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_4_Ops_6_guess_routine_from_dtype},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_4_Ops_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_4_Ops_10__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel__Ops[] = {
  {"ops", __pyx_getprop_4cupy_5_core_7_kernel_4_Ops_ops, 0, 0, 0},
  {"nin", __pyx_getprop_4cupy_5_core_7_kernel_4_Ops_nin, 0, 0, 0},
  {"nout", __pyx_getprop_4cupy_5_core_7_kernel_4_Ops_nout, 0, 0, 0},
  {"promote_types", __pyx_getprop_4cupy_5_core_7_kernel_4_Ops_promote_types, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel__Ops_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel__Ops},
  {Py_tp_doc, (void *)PyDoc_STR("_Ops(tuple ops, promote_types=None)\n\nA kernel routine representation with various dtype mappings.\n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel__Ops},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel__Ops},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel__Ops},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel__Ops},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_4_Ops_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel__Ops},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel__Ops_spec = {
  "cupy._core._kernel._Ops",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__Ops),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel__Ops_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel__Ops = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""_Ops", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel__Ops), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel__Ops, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("_Ops(tuple ops, promote_types=None)\n\nA kernel routine representation with various dtype mappings.\n    "), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel__Ops, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel__Ops, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel__Ops, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel__Ops, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_4_Ops_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel__Ops, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ElementwiseKernel __pyx_vtable_4cupy_5_core_7_kernel_ElementwiseKernel;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ElementwiseKernel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel_ElementwiseKernel;
  p->in_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->out_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->operation = Py_None; Py_INCREF(Py_None);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->__pyx___name__ = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->preamble = Py_None; Py_INCREF(Py_None);
  p->kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_params_type_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_elementwise_kernel_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_cached_codes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel_ElementwiseKernel(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel_ElementwiseKernel) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->in_params);
  Py_CLEAR(p->out_params);
  Py_CLEAR(p->params);
  Py_CLEAR(p->operation);
  Py_CLEAR(p->name);
  Py_CLEAR(p->__pyx___name__);
  Py_CLEAR(p->preamble);
  Py_CLEAR(p->kwargs);
  Py_CLEAR(p->_params_type_memo);
  Py_CLEAR(p->_elementwise_kernel_memo);
  Py_CLEAR(p->_cached_codes);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel_ElementwiseKernel(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->in_params) {
    e = (*v)(p->in_params, a); if (e) return e;
  }
  if (p->out_params) {
    e = (*v)(p->out_params, a); if (e) return e;
  }
  if (p->params) {
    e = (*v)(p->params, a); if (e) return e;
  }
  if (p->operation) {
    e = (*v)(p->operation, a); if (e) return e;
  }
  if (p->preamble) {
    e = (*v)(p->preamble, a); if (e) return e;
  }
  if (p->kwargs) {
    e = (*v)(p->kwargs, a); if (e) return e;
  }
  if (p->_params_type_memo) {
    e = (*v)(p->_params_type_memo, a); if (e) return e;
  }
  if (p->_elementwise_kernel_memo) {
    e = (*v)(p->_elementwise_kernel_memo, a); if (e) return e;
  }
  if (p->_cached_codes) {
    e = (*v)(p->_cached_codes, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel_ElementwiseKernel(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *)o;
  tmp = ((PyObject*)p->in_params);
  p->in_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->out_params);
  p->out_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->params);
  p->params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->operation);
  p->operation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->preamble);
  p->preamble = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->kwargs);
  p->kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_params_type_memo);
  p->_params_type_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_elementwise_kernel_memo);
  p->_elementwise_kernel_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_cached_codes);
  p->_cached_codes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_cached_codes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12cached_codes_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_cached_code(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11cached_code_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_in_params(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9in_params_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_out_params(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_10out_params_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nin(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3nin_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nout(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4nout_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nargs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5nargs_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_params(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6params_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_operation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9operation_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel___name__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8__name___1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_reduce_dims(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11reduce_dims_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_preamble(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_8preamble_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_no_return(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9no_return_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_return_tuple(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_12return_tuple_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_kwargs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_6kwargs_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__params_type_memo(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_17_params_type_memo_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__elementwise_kernel_memo(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_24_elementwise_kernel_memo_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__cached_codes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_13_cached_codes_1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel_ElementwiseKernel[] = {
  {"_decide_params_type", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_5_decide_params_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_4_decide_params_type},
  {"_get_elementwise_kernel", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_7_get_elementwise_kernel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_6_get_elementwise_kernel},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_10__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel_ElementwiseKernel[] = {
  {"cached_codes", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_cached_codes, 0, PyDoc_STR("Returns a dict that has input types as keys and codes values.\n\n        This property method is for debugging purpose.\n        The return value is not guaranteed to keep backward compatibility.\n        "), 0},
  {"cached_code", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_cached_code, 0, PyDoc_STR("Returns `next(iter(self.cached_codes.values()))`.\n\n        This property method is for debugging purpose.\n        The return value is not guaranteed to keep backward compatibility.\n        "), 0},
  {"in_params", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_in_params, 0, 0, 0},
  {"out_params", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_out_params, 0, 0, 0},
  {"nin", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nin, 0, 0, 0},
  {"nout", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nout, 0, 0, 0},
  {"nargs", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_nargs, 0, 0, 0},
  {"params", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_params, 0, 0, 0},
  {"operation", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_operation, 0, 0, 0},
  {"name", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_name, 0, 0, 0},
  {"__name__", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel___name__, 0, 0, 0},
  {"reduce_dims", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_reduce_dims, 0, 0, 0},
  {"preamble", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_preamble, 0, 0, 0},
  {"no_return", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_no_return, 0, 0, 0},
  {"return_tuple", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_return_tuple, 0, 0, 0},
  {"kwargs", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel_kwargs, 0, 0, 0},
  {"_params_type_memo", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__params_type_memo, 0, 0, 0},
  {"_elementwise_kernel_memo", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__elementwise_kernel_memo, 0, 0, 0},
  {"_cached_codes", __pyx_getprop_4cupy_5_core_7_kernel_17ElementwiseKernel__cached_codes, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel_ElementwiseKernel},
  {Py_tp_call, (void *)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3__call__},
  {Py_tp_doc, (void *)PyDoc_STR("ElementwiseKernel(in_params, out_params, operation, name='kernel', reduce_dims=True, preamble='', no_return=False, return_tuple=False, **kwargs)\n\nUser-defined elementwise kernel.\n\nThis class can be used to define an elementwise kernel with or without\nbroadcasting.\n\nThe kernel is compiled at an invocation of the\n:meth:`~ElementwiseKernel.__call__` method,\nwhich is cached for each device.\nThe compiled binary is also cached into a file under the\n``$HOME/.cupy/kernel_cache/`` directory with a hashed file name. The cached\nbinary is reused by other processes.\n\nArgs:\n    in_params (str): Input argument list.\n    out_params (str): Output argument list.\n    operation (str): The body in the loop written in CUDA-C/C++.\n    name (str): Name of the kernel function. It should be set for\n        readability of the performance profiling.\n    reduce_dims (bool): If ``False``, the shapes of array arguments are\n        kept within the kernel invocation. The shapes are reduced\n        (i.e., the arrays are reshaped without copy to the minimum\n        dimension) by default. It may make the kernel fast by reducing the\n        index calculations.\n    options (tuple): Compile options passed to NVRTC. For details, see\n        https://docs.nvidia.com/cuda/nvrtc/index.html#group__options.\n    preamble (str): Fragment of the CUDA-C/C++ code that is inserted at the\n        top of the cu file.\n    no_return (bool): If ``True``, __call__ returns ``None``.\n    return_tuple (bool): If ``True``, __call__ always returns tuple of\n        array even if single value is returned.\n    loop_prep (str): Fragment of the CUDA-C/C++ code that is inserted at\n        the top of the kernel function definition and above the ``for``\n        loop.\n    after_loop (str): Fragment of the CUDA-C/C++ code that is inserted at\n        the bottom of the kernel function definition.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel_ElementwiseKernel},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel_ElementwiseKernel},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel_ElementwiseKernel},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel_ElementwiseKernel},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel_ElementwiseKernel},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel_spec = {
  "cupy._core._kernel.ElementwiseKernel",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""ElementwiseKernel", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_3__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ElementwiseKernel(in_params, out_params, operation, name='kernel', reduce_dims=True, preamble='', no_return=False, return_tuple=False, **kwargs)\n\nUser-defined elementwise kernel.\n\nThis class can be used to define an elementwise kernel with or without\nbroadcasting.\n\nThe kernel is compiled at an invocation of the\n:meth:`~ElementwiseKernel.__call__` method,\nwhich is cached for each device.\nThe compiled binary is also cached into a file under the\n``$HOME/.cupy/kernel_cache/`` directory with a hashed file name. The cached\nbinary is reused by other processes.\n\nArgs:\n    in_params (str): Input argument list.\n    out_params (str): Output argument list.\n    operation (str): The body in the loop written in CUDA-C/C++.\n    name (str): Name of the kernel function. It should be set for\n        readability of the performance profiling.\n    reduce_dims (bool): If ``False``, the shapes of array arguments are\n        kept within the kernel invocation. The shapes are reduced\n        (i.e., the arrays are reshaped without copy to the minimum\n        dimension) by default. It may make the kernel fast by reducing the\n        index calculations.\n    options (tuple): Compile options passed to NVRTC. For details, see\n        https://docs.nvidia.com/cuda/nvrtc/index.html#group__options.\n    preamble (str): Fragment of the CUDA-C/C++ code that is inserted at the\n        top of the cu file.\n    no_return (bool): If ``True``, __call__ returns ``None``.\n    return_tuple (bool): If ``True``, __call__ always returns tuple of\n        array even if single value is returned.\n    loop_prep (str): Fragment of the CUDA-C/C++ code that is inserted at\n        the top of the kernel function definition and above the ``for``\n        loop.\n    after_loop (str): Fragment of the CUDA-C/C++ code that is inserted at\n        the bottom of the kernel function definition."), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_17ElementwiseKernel_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel_ElementwiseKernel, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_4cupy_5_core_7_kernel_ufunc __pyx_vtable_4cupy_5_core_7_kernel_ufunc;

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel_ufunc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)o);
  p->__pyx_vtab = __pyx_vtabptr_4cupy_5_core_7_kernel_ufunc;
  p->name = Py_None; Py_INCREF(Py_None);
  p->_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None); Py_INCREF(Py_None);
  p->_out_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None); Py_INCREF(Py_None);
  p->_preamble = Py_None; Py_INCREF(Py_None);
  p->_loop_prep = Py_None; Py_INCREF(Py_None);
  p->_default_casting = Py_None; Py_INCREF(Py_None);
  p->_cutensor_op = Py_None; Py_INCREF(Py_None);
  p->_scatter_op = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_params_with_where = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_routine_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_kernel_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_doc = Py_None; Py_INCREF(Py_None);
  p->__pyx___doc__ = Py_None; Py_INCREF(Py_None);
  p->__pyx___name__ = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel_ufunc(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel_ufunc) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->_ops);
  Py_CLEAR(p->_out_ops);
  Py_CLEAR(p->_preamble);
  Py_CLEAR(p->_loop_prep);
  Py_CLEAR(p->_default_casting);
  Py_CLEAR(p->_cutensor_op);
  Py_CLEAR(p->_scatter_op);
  Py_CLEAR(p->_params);
  Py_CLEAR(p->_params_with_where);
  Py_CLEAR(p->_routine_cache);
  Py_CLEAR(p->_kernel_memo);
  Py_CLEAR(p->_doc);
  Py_CLEAR(p->__pyx___doc__);
  Py_CLEAR(p->__pyx___name__);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel_ufunc(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->_ops) {
    e = (*v)(((PyObject *)p->_ops), a); if (e) return e;
  }
  if (p->_out_ops) {
    e = (*v)(((PyObject *)p->_out_ops), a); if (e) return e;
  }
  if (p->_preamble) {
    e = (*v)(p->_preamble, a); if (e) return e;
  }
  if (p->_loop_prep) {
    e = (*v)(p->_loop_prep, a); if (e) return e;
  }
  if (p->_default_casting) {
    e = (*v)(p->_default_casting, a); if (e) return e;
  }
  if (p->_cutensor_op) {
    e = (*v)(p->_cutensor_op, a); if (e) return e;
  }
  if (p->_params) {
    e = (*v)(p->_params, a); if (e) return e;
  }
  if (p->_params_with_where) {
    e = (*v)(p->_params_with_where, a); if (e) return e;
  }
  if (p->_routine_cache) {
    e = (*v)(p->_routine_cache, a); if (e) return e;
  }
  if (p->_kernel_memo) {
    e = (*v)(p->_kernel_memo, a); if (e) return e;
  }
  if (p->_doc) {
    e = (*v)(p->_doc, a); if (e) return e;
  }
  if (p->__pyx___doc__) {
    e = (*v)(p->__pyx___doc__, a); if (e) return e;
  }
  if (p->__pyx___name__) {
    e = (*v)(p->__pyx___name__, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_5_core_7_kernel_ufunc(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *p = (struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_ops);
  p->_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_out_ops);
  p->_out_ops = ((struct __pyx_obj_4cupy_5_core_7_kernel__Ops *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_preamble);
  p->_preamble = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_loop_prep);
  p->_loop_prep = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_default_casting);
  p->_default_casting = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_cutensor_op);
  p->_cutensor_op = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_params);
  p->_params = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_params_with_where);
  p->_params_with_where = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_routine_cache);
  p->_routine_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_kernel_memo);
  p->_kernel_memo = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_doc);
  p->_doc = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx___doc__);
  p->__pyx___doc__ = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx___name__);
  p->__pyx___name__ = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_5types_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nin(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_3nin_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nout(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_4nout_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nargs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_5nargs_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_4name_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__ops(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_ops_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__out_ops(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_8_out_ops_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__preamble(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_9_preamble_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__loop_prep(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_10_loop_prep_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__default_casting(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_16_default_casting_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_op(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_cutensor_op_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_alpha(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_alpha_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_gamma(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_15_cutensor_gamma_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__scatter_op(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_11_scatter_op_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__params(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7_params_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__params_with_where(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_18_params_with_where_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__routine_cache(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_14_routine_cache_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__kernel_memo(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_12_kernel_memo_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc__doc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_4_doc_1__get__(o);
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc___doc__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___1__get__(o);
}

static int __pyx_setprop_4cupy_5_core_7_kernel_5ufunc___doc__(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___3__set__(o, v);
  }
  else {
    return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_7__doc___5__del__(o);
  }
}

static PyObject *__pyx_getprop_4cupy_5_core_7_kernel_5ufunc___name__(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_4cupy_5_core_7_kernel_5ufunc_8__name___1__get__(o);
}

static PyMethodDef __pyx_methods_4cupy_5_core_7_kernel_ufunc[] = {
  {"outer", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_7outer, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_6outer},
  {"at", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_9at, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_8at},
  {"reduce", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_11reduce, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_10reduce},
  {"accumulate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_13accumulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_12accumulate},
  {"reduceat", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_15reduceat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_14reduceat},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_17__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_16__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_19__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_5ufunc_18__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_4cupy_5_core_7_kernel_ufunc[] = {
  {"types", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc_types, 0, PyDoc_STR("A list of type signatures.\n\n        Each type signature is represented by type character codes of inputs\n        and outputs separated by '->'.\n\n        "), 0},
  {"nin", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nin, 0, 0, 0},
  {"nout", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nout, 0, 0, 0},
  {"nargs", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc_nargs, 0, 0, 0},
  {"name", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc_name, 0, 0, 0},
  {"_ops", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__ops, 0, 0, 0},
  {"_out_ops", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__out_ops, 0, 0, 0},
  {"_preamble", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__preamble, 0, 0, 0},
  {"_loop_prep", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__loop_prep, 0, 0, 0},
  {"_default_casting", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__default_casting, 0, 0, 0},
  {"_cutensor_op", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_op, 0, 0, 0},
  {"_cutensor_alpha", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_alpha, 0, 0, 0},
  {"_cutensor_gamma", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__cutensor_gamma, 0, 0, 0},
  {"_scatter_op", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__scatter_op, 0, 0, 0},
  {"_params", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__params, 0, 0, 0},
  {"_params_with_where", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__params_with_where, 0, 0, 0},
  {"_routine_cache", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__routine_cache, 0, 0, 0},
  {"_kernel_memo", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__kernel_memo, 0, 0, 0},
  {"_doc", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc__doc, 0, 0, 0},
  {"__doc__", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc___doc__, __pyx_setprop_4cupy_5_core_7_kernel_5ufunc___doc__, PyDoc_STR("__doc__: object"), 0},
  {"__name__", __pyx_getprop_4cupy_5_core_7_kernel_5ufunc___name__, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel_ufunc_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel_ufunc},
  {Py_tp_repr, (void *)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_3__repr__},
  {Py_tp_call, (void *)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_5__call__},
  {Py_tp_doc, (void *)PyDoc_STR("ufunc(name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='', default_casting=None, _Ops out_ops=None, *, cutensor_op=None, scatter_op=None)\n\nUniversal function.\n\nAttributes:\n    ~ufunc.name (str): The name of the universal function.\n    ~ufunc.nin (int): Number of input arguments.\n    ~ufunc.nout (int): Number of output arguments.\n    ~ufunc.nargs (int): Number of all arguments.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel_ufunc},
  {Py_tp_clear, (void *)__pyx_tp_clear_4cupy_5_core_7_kernel_ufunc},
  {Py_tp_methods, (void *)__pyx_methods_4cupy_5_core_7_kernel_ufunc},
  {Py_tp_getset, (void *)__pyx_getsets_4cupy_5_core_7_kernel_ufunc},
  {Py_tp_init, (void *)__pyx_pw_4cupy_5_core_7_kernel_5ufunc_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel_ufunc},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel_ufunc_spec = {
  "cupy._core._kernel.ufunc",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel_ufunc_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel_ufunc = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""ufunc", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel_ufunc, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_4cupy_5_core_7_kernel_5ufunc_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_4cupy_5_core_7_kernel_5ufunc_5__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("ufunc(name, nin, nout, _Ops ops, preamble='', loop_prep='', doc='', default_casting=None, _Ops out_ops=None, *, cutensor_op=None, scatter_op=None)\n\nUniversal function.\n\nAttributes:\n    ~ufunc.name (str): The name of the universal function.\n    ~ufunc.nin (int): Number of input arguments.\n    ~ufunc.nout (int): Number of output arguments.\n    ~ufunc.nargs (int): Number of all arguments."), /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel_ufunc, /*tp_traverse*/
  __pyx_tp_clear_4cupy_5_core_7_kernel_ufunc, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_5_core_7_kernel_ufunc, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_4cupy_5_core_7_kernel_ufunc, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_4cupy_5_core_7_kernel_5ufunc_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel_ufunc, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr[--__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_i);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr[__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr_spec = {
  "cupy._core._kernel.__pyx_scope_struct__genexpr",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""__pyx_scope_struct__genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_i);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr_spec = {
  "cupy._core._kernel.__pyx_scope_struct_1_genexpr",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_i);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr_spec = {
  "cupy._core._kernel.__pyx_scope_struct_2_genexpr",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_i);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr_spec = {
  "cupy._core._kernel.__pyx_scope_struct_3_genexpr",
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy._core._kernel.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {"_full_mask_hex", (PyCFunction)__pyx_pw_4cupy_5_core_7_kernel_5_full_mask_hex, METH_NOARGS, __pyx_doc_4cupy_5_core_7_kernel_4_full_mask_hex},
  {"_check_peer_access", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_7_check_peer_access, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_6_check_peer_access},
  {"create_ufunc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_4cupy_5_core_7_kernel_19create_ufunc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_4cupy_5_core_7_kernel_18create_ufunc},
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_4cupy_5_core_7_kernel__numpy_can_cast = Py_None; Py_INCREF(Py_None);
  __pyx_v_4cupy_5_core_7_kernel__numpy_result_type = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  {
    __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_PyObject_PyObj);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_export_name = __pyx_export_signature + 848;
    void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__get_arginfos, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__get_out_args_from_optionals, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__get_out_args_with_params, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel_create_ufunc, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__broadcast, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__get_kernel_params, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__full_mask_hex, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__preprocess_args, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__check_peer_access, (void (*)(void))&__pyx_f_4cupy_5_core_7_kernel__reduce_dims, (void (*)(void)) NULL};
    void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers;
    const char *__pyx_export_current_signature = __pyx_export_signature;
    while (*__pyx_export_pointer) {
      if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_export_pointer;
      __pyx_export_name = strchr(__pyx_export_name, '\0') + 1;
      __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1;
      if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel_ParameterInfo_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel_ParameterInfo_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo = &__pyx_type_4cupy_5_core_7_kernel_ParameterInfo;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ParameterInfo_2, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ParameterInfo) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel__ArgInfo = &__pyx_vtable_4cupy_5_core_7_kernel__ArgInfo;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo._init = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, PyTypeObject *, PyObject *, int, int, int))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo__init;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_arg = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(PyObject *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_arg;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_ndarray = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_ndarray;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_scalar = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_scalar;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_indexer = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_5_core_7_carray_Indexer *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_indexer;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_memptr = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_memptr;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.from_texture = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_from_texture;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.as_ndarray_with_ndim = (struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, int))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_as_ndarray_with_ndim;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.is_ndarray = (int (*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_ndarray;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.is_scalar = (int (*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_is_scalar;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.get_c_type = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type *__pyx_optional_args))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_type;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.get_param_c_type = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type *__pyx_optional_args))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_param_c_type;
  __pyx_vtable_4cupy_5_core_7_kernel__ArgInfo.get_c_var_name = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__ArgInfo *, struct __pyx_obj_4cupy_5_core_7_kernel_ParameterInfo *))__pyx_f_4cupy_5_core_7_kernel_8_ArgInfo_get_c_var_name;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel__ArgInfo_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo)) __PYX_ERR(0, 189, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel__ArgInfo_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo = &__pyx_type_4cupy_5_core_7_kernel__ArgInfo;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo, __pyx_vtabptr_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ArgInfo_2, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__ArgInfo) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel__TypeMap = &__pyx_vtable_4cupy_5_core_7_kernel__TypeMap;
  __pyx_vtable_4cupy_5_core_7_kernel__TypeMap.get_typedef_code = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, struct __pyx_opt_args_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code *__pyx_optional_args))__pyx_f_4cupy_5_core_7_kernel_8_TypeMap_get_typedef_code;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel__TypeMap_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap)) __PYX_ERR(0, 534, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel__TypeMap_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap = &__pyx_type_4cupy_5_core_7_kernel__TypeMap;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap, __pyx_vtabptr_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TypeMap_2, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__TypeMap) < (0)) __PYX_ERR(0, 534, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel__Op = &__pyx_vtable_4cupy_5_core_7_kernel__Op;
  __pyx_vtable_4cupy_5_core_7_kernel__Op._from_type_and_routine_or_error_func = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(PyObject *, PyObject *, PyObject *, PyObject *))__pyx_f_4cupy_5_core_7_kernel_3_Op__from_type_and_routine_or_error_func;
  __pyx_vtable_4cupy_5_core_7_kernel__Op.from_type_and_routine = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(PyObject *, PyObject *, PyObject *))__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_routine;
  __pyx_vtable_4cupy_5_core_7_kernel__Op.resolve_dtypes = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__Op *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4cupy_5_core_7_kernel_3_Op_resolve_dtypes;
  __pyx_vtable_4cupy_5_core_7_kernel__Op.from_type_and_error_func = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(PyObject *, PyObject *))__pyx_f_4cupy_5_core_7_kernel_3_Op_from_type_and_error_func;
  __pyx_vtable_4cupy_5_core_7_kernel__Op.check_valid = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__Op *))__pyx_f_4cupy_5_core_7_kernel_3_Op_check_valid;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel__Op_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op)) __PYX_ERR(0, 1532, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel__Op_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op = &__pyx_type_4cupy_5_core_7_kernel__Op;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op, __pyx_vtabptr_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Op, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Op) < (0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel__Ops = &__pyx_vtable_4cupy_5_core_7_kernel__Ops;
  __pyx_vtable_4cupy_5_core_7_kernel__Ops.from_tuples = (struct __pyx_obj_4cupy_5_core_7_kernel__Ops *(*)(PyObject *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops_from_tuples *__pyx_optional_args))__pyx_f_4cupy_5_core_7_kernel_4_Ops_from_tuples;
  __pyx_vtable_4cupy_5_core_7_kernel__Ops.guess_routine = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, int __pyx_skip_dispatch))__pyx_f_4cupy_5_core_7_kernel_4_Ops_guess_routine;
  __pyx_vtable_4cupy_5_core_7_kernel__Ops._guess_routine_from_in_types = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types *__pyx_optional_args))__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_in_types;
  __pyx_vtable_4cupy_5_core_7_kernel__Ops._guess_routine_from_dtype = (struct __pyx_obj_4cupy_5_core_7_kernel__Op *(*)(struct __pyx_obj_4cupy_5_core_7_kernel__Ops *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4cupy_5_core_7_kernel_4_Ops__guess_routine_from_dtype;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel__Ops_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops)) __PYX_ERR(0, 1611, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel__Ops_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops = &__pyx_type_4cupy_5_core_7_kernel__Ops;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops, __pyx_vtabptr_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Ops, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel__Ops) < (0)) __PYX_ERR(0, 1611, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel_ElementwiseKernel = &__pyx_vtable_4cupy_5_core_7_kernel_ElementwiseKernel;
  __pyx_vtable_4cupy_5_core_7_kernel_ElementwiseKernel._decide_params_type = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__decide_params_type;
  __pyx_vtable_4cupy_5_core_7_kernel_ElementwiseKernel._get_elementwise_kernel = (struct __pyx_obj_4cupy_4cuda_8function_Function *(*)(struct __pyx_obj_4cupy_5_core_7_kernel_ElementwiseKernel *, int, PyObject *, struct __pyx_obj_4cupy_5_core_7_kernel__TypeMap *, int __pyx_skip_dispatch))__pyx_f_4cupy_5_core_7_kernel_17ElementwiseKernel__get_elementwise_kernel;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel)) __PYX_ERR(0, 743, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel = &__pyx_type_4cupy_5_core_7_kernel_ElementwiseKernel;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 743, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__.doc = __pyx_doc_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cupy_5_core_7_kernel_17ElementwiseKernel_2__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel, __pyx_vtabptr_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ElementwiseKernel, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ElementwiseKernel) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_kernel_ufunc = &__pyx_vtable_4cupy_5_core_7_kernel_ufunc;
  __pyx_vtable_4cupy_5_core_7_kernel_ufunc._get_name_with_type = (PyObject *(*)(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *, PyObject *, int))__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_name_with_type;
  __pyx_vtable_4cupy_5_core_7_kernel_ufunc._get_ufunc_kernel = (struct __pyx_obj_4cupy_4cuda_8function_Function *(*)(struct __pyx_obj_4cupy_5_core_7_kernel_ufunc *, PyObject *, PyObject *, int, struct __pyx_obj_4cupy_5_core_7_kernel__Op *, PyObject *, int))__pyx_f_4cupy_5_core_7_kernel_5ufunc__get_ufunc_kernel;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel_ufunc_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc)) __PYX_ERR(0, 1147, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel_ufunc_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc = &__pyx_type_4cupy_5_core_7_kernel_ufunc;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1147, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_4cupy_5_core_7_kernel_5ufunc_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_4cupy_5_core_7_kernel_5ufunc_4__call__.doc = __pyx_doc_4cupy_5_core_7_kernel_5ufunc_4__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cupy_5_core_7_kernel_5ufunc_4__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc, __pyx_vtabptr_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ufunc, (PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel_ufunc) < (0)) __PYX_ERR(0, 1147, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr)) __PYX_ERR(0, 1209, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 1209, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr = &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 1209, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct__genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 1212, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 1212, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr = &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 1212, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 1503, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 1503, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr = &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 1503, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 1513, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 1513, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr = &__pyx_type_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 1513, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_4cupy_5_core_7_kernel___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("cupy.cuda.function"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_CPointer = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.function", "CPointer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_CPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_CPointer),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_CPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_CPointer),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_CPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_CPointer),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_CPointer) __PYX_ERR(8, 4, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Function = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.function", "Function",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Function), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Function),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Function), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Function),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Function), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Function),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Function) __PYX_ERR(8, 9, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_8function_Function = (struct __pyx_vtabstruct_4cupy_4cuda_8function_Function*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Function); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_8function_Function)) __PYX_ERR(8, 9, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Module = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.function", "Module",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Module), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Module),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Module), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Module),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_Module), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_Module),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Module) __PYX_ERR(8, 20, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_8function_Module = (struct __pyx_vtabstruct_4cupy_4cuda_8function_Module*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_Module); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_8function_Module)) __PYX_ERR(8, 20, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_LinkState = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.function", "LinkState",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_LinkState), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_LinkState),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_LinkState), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_LinkState),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_8function_LinkState), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_8function_LinkState),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_LinkState) __PYX_ERR(8, 34, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_8function_LinkState = (struct __pyx_vtabstruct_4cupy_4cuda_8function_LinkState*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_8function_LinkState); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_8function_LinkState)) __PYX_ERR(8, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy._core._carray"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_mdspan = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core._carray", "mdspan",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_mdspan), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_mdspan),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_mdspan), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_mdspan),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_mdspan), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_mdspan),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_mdspan) __PYX_ERR(9, 22, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_carray_mdspan = (struct __pyx_vtabstruct_4cupy_5_core_7_carray_mdspan*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_mdspan); if (unlikely(!__pyx_vtabptr_4cupy_5_core_7_carray_mdspan)) __PYX_ERR(9, 22, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CArray = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core._carray", "CArray",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CArray),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CArray),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CArray),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CArray) __PYX_ERR(9, 31, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_carray_CArray = (struct __pyx_vtabstruct_4cupy_5_core_7_carray_CArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CArray); if (unlikely(!__pyx_vtabptr_4cupy_5_core_7_carray_CArray)) __PYX_ERR(9, 31, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CIndexer = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core._carray", "CIndexer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_CIndexer),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CIndexer) __PYX_ERR(9, 44, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_carray_CIndexer = (struct __pyx_vtabstruct_4cupy_5_core_7_carray_CIndexer*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_CIndexer); if (unlikely(!__pyx_vtabptr_4cupy_5_core_7_carray_CIndexer)) __PYX_ERR(9, 44, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_Indexer = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core._carray", "Indexer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_Indexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_Indexer),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_Indexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_Indexer),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_7_carray_Indexer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_carray_Indexer),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_Indexer) __PYX_ERR(9, 49, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_carray_Indexer = (struct __pyx_vtabstruct_4cupy_5_core_7_carray_Indexer*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_carray_Indexer); if (unlikely(!__pyx_vtabptr_4cupy_5_core_7_carray_Indexer)) __PYX_ERR(9, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_5(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(10, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_2_5(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyLongObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyLongObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(11, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_2_5(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyComplexObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyComplexObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(12, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "dtype",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArray_Descr),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArray_Descr),
  #else
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArray_Descr),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 229, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "flatiter",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayIterObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayIterObject),
  #else
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayIterObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 274, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "broadcast",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayMultiIterObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayMultiIterObject),
  #else
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayMultiIterObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 278, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "ndarray",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayObject),
  #else
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyArrayObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 317, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "generic",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(1, 826, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "number",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(1, 828, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "integer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(1, 830, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "signedinteger",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 832, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "unsignedinteger",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 834, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "inexact",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 836, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "floating",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(1, 838, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "complexfloating",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 840, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "flexible",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 842, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "character",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(1, 844, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_5(__pyx_t_1, "numpy", "ufunc",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyUFuncObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyUFuncObject),
  #else
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(PyUFuncObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_5); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 908, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy._core._scalar"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_5_core_7_scalar_CScalar = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core._scalar", "CScalar",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_7_scalar_CScalar),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_7_scalar_CScalar) __PYX_ERR(13, 20, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_7_scalar_CScalar = (struct __pyx_vtabstruct_4cupy_5_core_7_scalar_CScalar*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_7_scalar_CScalar); if (unlikely(!__pyx_vtabptr_4cupy_5_core_7_scalar_CScalar)) __PYX_ERR(13, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy.cuda.device"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6device_Handle = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.device", "Handle",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Handle), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Handle),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Handle), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Handle),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Handle), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Handle),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6device_Handle) __PYX_ERR(14, 13, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6device_Device = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.device", "Device",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Device), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Device),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Device), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Device),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6device_Device), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6device_Device),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6device_Device) __PYX_ERR(14, 18, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6device_Device = (struct __pyx_vtabstruct_4cupy_4cuda_6device_Device*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6device_Device); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6device_Device)) __PYX_ERR(14, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy.cuda.memory"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_BaseMemory = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "BaseMemory",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_BaseMemory),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_BaseMemory) __PYX_ERR(2, 10, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_SystemMemory = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "SystemMemory",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_SystemMemory),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_SystemMemory) __PYX_ERR(2, 19, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6memory_SystemMemory = (struct __pyx_vtabstruct_4cupy_4cuda_6memory_SystemMemory*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_SystemMemory); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6memory_SystemMemory)) __PYX_ERR(2, 19, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "MemoryPointer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPointer),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer) __PYX_ERR(2, 29, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6memory_MemoryPointer = (struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPointer*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPointer); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6memory_MemoryPointer)) __PYX_ERR(2, 29, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPool = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "MemoryPool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_MemoryPool),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPool) __PYX_ERR(2, 58, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6memory_MemoryPool = (struct __pyx_vtabstruct_4cupy_4cuda_6memory_MemoryPool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_MemoryPool); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6memory_MemoryPool)) __PYX_ERR(2, 58, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocatorMemory = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "CFunctionAllocatorMemory",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocatorMemory),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocatorMemory) __PYX_ERR(2, 89, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "CFunctionAllocator",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_CFunctionAllocator),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator) __PYX_ERR(2, 97, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6memory_CFunctionAllocator = (struct __pyx_vtabstruct_4cupy_4cuda_6memory_CFunctionAllocator*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_CFunctionAllocator); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6memory_CFunctionAllocator)) __PYX_ERR(2, 97, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "PythonFunctionAllocatorMemory",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocatorMemory) __PYX_ERR(2, 108, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.memory", "PythonFunctionAllocator",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_6memory_PythonFunctionAllocator),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator) __PYX_ERR(2, 114, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_6memory_PythonFunctionAllocator = (struct __pyx_vtabstruct_4cupy_4cuda_6memory_PythonFunctionAllocator*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_6memory_PythonFunctionAllocator); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_6memory_PythonFunctionAllocator)) __PYX_ERR(2, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy._core.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_5_core_4core__ndarray_base = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy._core.core", "_ndarray_base",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_5_core_4core__ndarray_base), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_4core__ndarray_base),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_5_core_4core__ndarray_base), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_4core__ndarray_base),
  #else
  sizeof(struct __pyx_obj_4cupy_5_core_4core__ndarray_base), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_5_core_4core__ndarray_base),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_5_core_4core__ndarray_base) __PYX_ERR(3, 10, __pyx_L1_error)
  __pyx_vtabptr_4cupy_5_core_4core__ndarray_base = (struct __pyx_vtabstruct_4cupy_5_core_4core__ndarray_base*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_5_core_4core__ndarray_base); if (unlikely(!__pyx_vtabptr_4cupy_5_core_4core__ndarray_base)) __PYX_ERR(3, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy.cuda.texture"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_ChannelFormatDescriptor = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "ChannelFormatDescriptor",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ChannelFormatDescriptor),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_ChannelFormatDescriptor) __PYX_ERR(15, 6, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_ResourceDescriptor = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "ResourceDescriptor",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_ResourceDescriptor),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_ResourceDescriptor) __PYX_ERR(15, 11, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_TextureDescriptor = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "TextureDescriptor",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureDescriptor),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_TextureDescriptor) __PYX_ERR(15, 19, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_CUDAarray = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "CUDAarray",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_CUDAarray),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_CUDAarray) __PYX_ERR(15, 24, __pyx_L1_error)
  __pyx_vtabptr_4cupy_4cuda_7texture_CUDAarray = (struct __pyx_vtabstruct_4cupy_4cuda_7texture_CUDAarray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_CUDAarray); if (unlikely(!__pyx_vtabptr_4cupy_4cuda_7texture_CUDAarray)) __PYX_ERR(15, 24, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_TextureObject = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "TextureObject",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_TextureObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_TextureObject) __PYX_ERR(15, 37, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_SurfaceObject = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy.cuda.texture", "SurfaceObject",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject),
  #else
  sizeof(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_4cupy_4cuda_7texture_SurfaceObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_4cupy_4cuda_7texture_SurfaceObject) __PYX_ERR(15, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cupy_backends.cuda.api.runtime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_PointerAttributes = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy_backends.cuda.api.runtime", "PointerAttributes",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes),
  #else
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_PointerAttributes),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_PointerAttributes) __PYX_ERR(16, 8, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_MemPoolProps = __Pyx_ImportType_3_2_5(__pyx_t_1, "cupy_backends.cuda.api.runtime", "MemPoolProps",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps),
  #else
  sizeof(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps), __PYX_GET_STRUCT_ALIGNMENT_3_2_5(struct __pyx_obj_13cupy_backends_4cuda_3api_7runtime_MemPoolProps),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_5); if (!__pyx_mstate->__pyx_ptype_13cupy_backends_4cuda_3api_7runtime_MemPoolProps) __PYX_ERR(16, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._scalar"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_scalar_type_set);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 11;
    void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_4cupy_5_core_7_scalar_scalar_type_set, (void **) NULL};
    void **const *__pyx_import_pointer = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportVoidPtr_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._accelerator"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject__elementwise_accelerato);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 13;
    void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_4cupy_5_core_12_accelerator__elementwise_accelerators, (void **)&__pyx_vp_4cupy_5_core_12_accelerator__reduction_accelerators, (void **)&__pyx_vp_4cupy_5_core_12_accelerator__routine_accelerators, (void **) NULL};
    void **const *__pyx_import_pointer = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportVoidPtr_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._dtype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_all_type_chars_all_type);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 12;
    void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_4cupy_5_core_6_dtype_all_type_chars, (void **)&__pyx_vp_4cupy_5_core_6_dtype_all_type_chars_b, (void **) NULL};
    void **const *__pyx_import_pointer = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportVoidPtr_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy_backends.cuda.api.runtime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_int__is_hip_environment_deviceAt);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 11;
    void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime__is_hip_environment, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMajor, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_deviceAttributeComputeCapabilityMinor, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorContextIsDestroyed, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidResourceHandle, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorInvalidValue, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorMemoryAllocation, (void **)&__pyx_vp_13cupy_backends_4cuda_3api_7runtime_errorPeerAccessAlreadyEnabled, (void **) NULL};
    void **const *__pyx_import_pointer = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportVoidPtr_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._carray"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_struct___pyx_obj_4cupy_5_core_7);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 96;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_7_carray__indexer_init, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._scalar"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_int___pyx_skip);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 175;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_7_scalar_format_type_decls, (void (**)(void))&__pyx_f_4cupy_5_core_7_scalar_get_typename, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy.cuda.device"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_int_int___pyx_skip_dispatch_int);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 45;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_4cuda_6device_get_device_id, (void (**)(void))&__pyx_f_4cupy_4cuda_6device__enable_peer_access, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_struct___pyx_obj_4cupy_4cuda_8fu);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 549;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_4core_compile_with_cache, (void (**)(void))&__pyx_f_4cupy_5_core_4core__ndarray_init, (void (**)(void))&__pyx_f_4cupy_5_core_4core__convert_object_with_cuda_array_interface, (void (**)(void))&__pyx_f_4cupy_5_core_4core_array, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._dtype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject_int___pyx_skip_2);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 203;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_6_dtype_get_dtype, (void (**)(void))&__pyx_f_4cupy_5_core_6_dtype__raise_if_invalid_cast, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core._memory_range"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_int_struct___pyx_obj_4cupy_5_cor);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 136;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_13_memory_range_may_share_bounds, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy._core.internal"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_PyObject___pyx_t_4cupy);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 162;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_4cupy_5_core_8internal__broadcast_core, (void (**)(void))&__pyx_f_4cupy_5_core_8internal_vector_equal, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  {
    __pyx_t_1 = PyImport_ImportModule("cupy_backends.cuda.api.runtime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject_int_int___pyx_skip_disp);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
    #endif
    const char * __pyx_import_name = __pyx_import_signature + 71;
    void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_13cupy_backends_4cuda_3api_7runtime_getDeviceProperties, (void (**)(void))&__pyx_f_13cupy_backends_4cuda_3api_7runtime_getDevice, (void (**)(void)) NULL};
    void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers;
    const char *__pyx_import_current_signature = __pyx_import_signature;
    while (*__pyx_import_pointer) {
      if (__Pyx_ImportFunction_3_2_5(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      ++__pyx_import_pointer;
      __pyx_import_name = strchr(__pyx_import_name, '\0') + 1;
      __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1;
      if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec__kernel(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__kernel},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "_kernel",
      0, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit__kernel(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__kernel(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
{
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec__kernel(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  size_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module '_kernel' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_kernel" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_NOT_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
    PyErr_Clear();
    __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
    if (!__Pyx_RefNanny)
        Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  
__Pyx_RefNannySetupContext("PyInit__kernel", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_cupy___core___kernel) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "cupy._core._kernel")) {
      if (unlikely((PyDict_SetItemString(modules, "cupy._core._kernel", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/

  /* "cupy/_core/_kernel.pyx":1
 * import string             # <<<<<<<<<<<<<<
 * import warnings
 * 
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_string, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_string, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":2
 * import string
 * import warnings             # <<<<<<<<<<<<<<
 * 
 * import numpy
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":4
 * import warnings
 * 
 * import numpy             # <<<<<<<<<<<<<<
 * 
 * import cupy
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_2) < (0)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":6
 * import numpy
 * 
 * import cupy             # <<<<<<<<<<<<<<
 * from cupy.cuda import compiler
 * from cupy import _util
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cupy, __pyx_t_2) < (0)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":7
 * 
 * import cupy
 * from cupy.cuda import compiler             # <<<<<<<<<<<<<<
 * from cupy import _util
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_compiler};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy_cuda, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_compiler};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":8
 * import cupy
 * from cupy.cuda import compiler
 * from cupy import _util             # <<<<<<<<<<<<<<
 * 
 * cimport cython  # NOQA
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":23
 * from cupy._core._dtype cimport get_dtype, _raise_if_invalid_cast
 * from cupy._core._memory_range cimport may_share_bounds
 * from cupy._core._scalar import get_typename as _get_typename             # <<<<<<<<<<<<<<
 * from cupy._core cimport core
 * from cupy._core.core cimport _convert_from_cupy_like
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_typename_2};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy__core__scalar, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_typename_2};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_typename, __pyx_t_4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error)
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":31
 * from cupy._core cimport internal
 * from cupy_backends.cuda.api cimport runtime
 * from cupy_backends.cuda.api import driver as _driver             # <<<<<<<<<<<<<<
 * 
 * try:
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_driver};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy_backends_cuda_api, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_2);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_driver};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      switch (__pyx_t_3) {
        case 0:
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_driver_2, __pyx_t_4) < (0)) __PYX_ERR(0, 31, __pyx_L1_error)
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/_core/_kernel.pyx":33
 * from cupy_backends.cuda.api import driver as _driver
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor
 * except ImportError:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "cupy/_core/_kernel.pyx":34
 * 
 * try:
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor             # <<<<<<<<<<<<<<
 * except ImportError:
 *     cuda_cutensor = None
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_cutensor};
        __pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy_backends_cuda_libs, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L2_error)
      }
      __pyx_t_2 = __pyx_t_7;
      __Pyx_GOTREF(__pyx_t_2);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_cutensor};
        __pyx_t_3 = 0; {
          __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_4);
          switch (__pyx_t_3) {
            case 0:
            if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cuda_cutensor, __pyx_t_4) < (0)) __PYX_ERR(0, 34, __pyx_L2_error)
            break;
            default:;
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "cupy/_core/_kernel.pyx":33
 * from cupy_backends.cuda.api import driver as _driver
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor
 * except ImportError:
*/
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cupy/_core/_kernel.pyx":35
 * try:
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor
 * except ImportError:             # <<<<<<<<<<<<<<
 *     cuda_cutensor = None
 * 
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ImportError))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("cupy._core._kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_9) < 0) __PYX_ERR(0, 35, __pyx_L4_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_9);

      /* "cupy/_core/_kernel.pyx":36
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor
 * except ImportError:
 *     cuda_cutensor = None             # <<<<<<<<<<<<<<
 * 
 * from cupy._core import _fusion_thread_local
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cuda_cutensor, Py_None) < (0)) __PYX_ERR(0, 36, __pyx_L4_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;

    /* "cupy/_core/_kernel.pyx":33
 * from cupy_backends.cuda.api import driver as _driver
 * 
 * try:             # <<<<<<<<<<<<<<
 *     from cupy_backends.cuda.libs import cutensor as cuda_cutensor
 * except ImportError:
*/
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_5, __pyx_t_6);
    __pyx_L7_try_end:;
  }

  /* "cupy/_core/_kernel.pyx":38
 *     cuda_cutensor = None
 * 
 * from cupy._core import _fusion_thread_local             # <<<<<<<<<<<<<<
 * 
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_fusion_thread_local};
    __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_cupy__core, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error)
  }
  __pyx_t_9 = __pyx_t_6;
  __Pyx_GOTREF(__pyx_t_9);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_fusion_thread_local};
    __pyx_t_3 = 0; {
      __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_9, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":48
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_warpsize():
 *     device_id = runtime.getDevice()
*/
  __pyx_t_4 = NULL;
  __pyx_t_10 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, NULL};
    __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_for_each_device, Py_True, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 48, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_12 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_1_get_warpsize, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_12};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_warpsize, __pyx_t_9) < (0)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":55
 * 
 * # ROCm 7+ requires a 64-bit mask type for __shfl_*_sync / __any_sync.
 * _is_hip_7_plus = (runtime._is_hip_environment             # <<<<<<<<<<<<<<
 *                   and _driver.get_build_version() >= 7_00_00000)
 * 
*/
  if (__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_13cupy_backends_4cuda_3api_7runtime__is_hip_environment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L10_bool_binop_done;
  }

  /* "cupy/_core/_kernel.pyx":56
 * # ROCm 7+ requires a 64-bit mask type for __shfl_*_sync / __any_sync.
 * _is_hip_7_plus = (runtime._is_hip_environment
 *                   and _driver.get_build_version() >= 7_00_00000)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_driver_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_build_version); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, __pyx_mstate_global->__pyx_int_70000000, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_9 = __pyx_t_11;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_L10_bool_binop_done:;
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_is_hip_7_plus, __pyx_t_9) < (0)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":62
 * # Computed lazily (per device) so that importing CuPy does not require a
 * # functional ROCm/CUDA runtime.
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _full_mask():
 *     if runtime._is_hip_environment:
*/
  __pyx_t_11 = NULL;
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_for_each_device, Py_True, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 62, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_10 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_3_full_mask, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_10};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_full_mask, __pyx_t_9) < (0)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":521
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_param_info(str s, is_const):
 *     if len(s) == 0:
*/
  __pyx_t_2 = NULL;
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
    __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  }
  __pyx_t_12 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_9_get_param_info, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_12};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_param_info, __pyx_t_9) < (0)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":528
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _decide_params_type(in_params, out_params, in_args_dtype, out_args_dtype):
 *     return _decide_params_type_core(in_params, out_params, in_args_dtype,
*/
  __pyx_t_10 = NULL;
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  }
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_11_decide_params_type, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_decide_params_type, __pyx_t_9) < (0)) __PYX_ERR(0, 528, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":643
 * 
 * 
 * cdef _numpy_can_cast = numpy.can_cast             # <<<<<<<<<<<<<<
 * cdef _numpy_result_type = numpy.result_type
 * 
*/
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_can_cast); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_XGOTREF(__pyx_v_4cupy_5_core_7_kernel__numpy_can_cast);
  __Pyx_DECREF_SET(__pyx_v_4cupy_5_core_7_kernel__numpy_can_cast, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "cupy/_core/_kernel.pyx":644
 * 
 * cdef _numpy_can_cast = numpy.can_cast
 * cdef _numpy_result_type = numpy.result_type             # <<<<<<<<<<<<<<
 * 
 * cdef list _get_out_args_from_optionals(
*/
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_result_type); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_XGOTREF(__pyx_v_4cupy_5_core_7_kernel__numpy_result_type);
  __Pyx_DECREF_SET(__pyx_v_4cupy_5_core_7_kernel__numpy_result_type, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":709
 * 
 * 
 * @_util.memoize()             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel_code(
 *         tuple arginfos, _TypeMap type_map,
*/
  __pyx_t_12 = NULL;
  __pyx_t_10 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_13_get_elementwise_kernel_code, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_11};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel_code, __pyx_t_9) < (0)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":731
 * 
 * 
 * @_util.memoize(for_each_device=True)             # <<<<<<<<<<<<<<
 * def _get_elementwise_kernel(
 *         tuple arginfos, _TypeMap type_map,
*/
  __pyx_t_4 = NULL;
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_memoize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL};
    __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_for_each_device, Py_True, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 731, __pyx_L1_error)
    __pyx_t_11 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
  }
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_15_get_elementwise_kernel, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
    __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_elementwise_kernel, __pyx_t_9) < (0)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":1496
 * 
 * 
 * def _ufunc_doc_signature_formatter(ufunc, name):             # <<<<<<<<<<<<<<
 *     # Based on implementation in NumPy (numpy/_core/_internal.py)
 * 
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_17_ufunc_doc_signature_formatter, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ufunc_doc_signature_formatter, __pyx_t_9) < (0)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":1710
 *     cpdef _Op _guess_routine_from_in_types(
 *             self, tuple in_types, tuple weaks=None,
 *             object can_cast=_numpy_can_cast             # <<<<<<<<<<<<<<
 *     ):
 *         cdef _Op op
*/
  __Pyx_INCREF(__pyx_v_4cupy_5_core_7_kernel__numpy_can_cast);
  __pyx_mstate_global->__pyx_k__21 = __pyx_v_4cupy_5_core_7_kernel__numpy_can_cast;
  __Pyx_GIVEREF(__pyx_v_4cupy_5_core_7_kernel__numpy_can_cast);

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__ArgInfo(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xce9b415, 0x9f04a0e, 0x071fe97, b'arg_kind, c_contiguous, dtype, index_32_bits, ndim, type')
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_21__pyx_unpickle__ArgInfo, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__ArgInfo, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":1
 * cdef extern from *:             # <<<<<<<<<<<<<<
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_23__pyx_unpickle_ParameterInfo, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ParameterInfo, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__TypeMap(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xc112a28, 0x7a66b83, 0x4e41e23, b'_pairs')
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_25__pyx_unpickle__TypeMap, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__TypeMap, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":1
 * cdef extern from *:             # <<<<<<<<<<<<<<
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_27__pyx_unpickle_ElementwiseKernel, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ElementwiseKernel, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ufunc(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x487502e, 0x072ed3e, 0xc4392e8, b'__doc__, __name__, _cutensor_alpha, _cutensor_gamma, _cutensor_op, _default_casting, _doc, _kernel_memo, _loop_prep, _ops, _out_ops, _params, _params_with_where, _preamble, _routine_cache, _scatter_op, name, nargs, nin, nout')
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_29__pyx_unpickle_ufunc, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ufunc, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":1
 * cdef extern from *:             # <<<<<<<<<<<<<<
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_31__pyx_unpickle__Op, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Op, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle__Ops(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x1a1a414, 0x40861f4, 0x710b3b2, b'nin, nout, ops, promote_types')
*/
  __pyx_t_9 = PyCFunction_NewEx(&__pyx_mdef_4cupy_5_core_7_kernel_33__pyx_unpickle__Ops, NULL, __pyx_mstate_global->__pyx_n_u_cupy__core__kernel); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle__Ops, __pyx_t_9) < (0)) __PYX_ERR(7, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "cupy/_core/_kernel.pyx":1
 * import string             # <<<<<<<<<<<<<<
 * import warnings
 * 
*/
  __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_9) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init cupy._core._kernel", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cupy._core._kernel");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 563, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 615, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_map); if (!__pyx_builtin_map) __PYX_ERR(0, 1569, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.type = (PyObject*)(&PyUnicode_Type);
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.method_name = &__pyx_mstate->__pyx_n_u_strip;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cupy/_core/_kernel.pyx":814
 *         self.nout = len(self.out_params)
 *         self.nargs = self.nin + self.nout
 *         param_rest = _get_param_info('CIndexer _ind', False)             # <<<<<<<<<<<<<<
 *         self.params = self.in_params + self.out_params + param_rest
 *         self.operation = operation
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_CIndexer__ind, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "cupy/_core/_kernel.pyx":1100
 *     return _get_simple_elementwise_kernel(
 *         params, arginfos, operation, name, type_map, preamble,
 *         loop_prep=loop_prep, after_loop='', options=("--std=c++17",))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_std_c_17); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "cupy/_core/_kernel.pyx":1218
 *         self._params = _in_params + _out_params + _other_params
 *         self._params_with_where = (
 *             _in_params + (ParameterInfo('T _where', False),)             # <<<<<<<<<<<<<<
 *             + _out_params + _other_params)
 *         self._routine_cache = {}
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_T__where, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "cupy/_core/_kernel.pyx":1443
 *         ndim_a = A.ndim
 *         ndim_b = B.ndim
 *         A = A.reshape(A.shape + (1,) * ndim_b)             # <<<<<<<<<<<<<<
 *         B = B.reshape((1,) * ndim_a + B.shape)
 *         return self(A, B, **kwargs)
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[3], 0, __pyx_mstate_global->__pyx_int_1) != (0)) __PYX_ERR(0, 1443, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

  /* "cupy/_core/_kernel.pyx":1514
 *             positional=', '.join(
 *                 'out{}'.format(i+1) for i in range(ufunc.nout)),
 *             default=repr((None,)*ufunc.nout)             # <<<<<<<<<<<<<<
 *         )
 * 
*/
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[4], 0, Py_None) != (0)) __PYX_ERR(0, 1514, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

  /* "cupy/_core/_kernel.pyx":1685
 * 
 *             if not _check_should_use_weak_scalar(in_types, weaks):
 *                 weaks = (False,) * len(in_args)             # <<<<<<<<<<<<<<
 * 
 *             op = cache.get((in_types, weaks), ())
*/
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 1685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[5], 0, Py_False) != (0)) __PYX_ERR(0, 1685, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<6; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 10; } index[] = {{2},{10},{9},{14},{7},{9},{13},{35},{28},{62},{43},{25},{23},{26},{82},{4},{179},{23},{37},{42},{30},{19},{46},{50},{66},{16},{8},{6},{7},{36},{88},{60},{13},{20},{20},{18},{92},{12},{1},{1},{1},{5},{2},{1},{8},{2},{6},{1},{1},{1},{1},{0},{1},{2},{1},{5},{1},{2},{29},{33},{8},{13},{25},{36},{17},{11},{6},{16},{38},{10},{23},{22},{161},{7},{13},{10},{6},{13},{20},{25},{2},{6},{30},{15},{38},{21},{4},{12},{18},{11},{13},{40},{9},{39},{9},{9},{39},{34},{19},{5},{11},{13},{5},{31},{14},{37},{8},{8},{29},{31},{10},{11},{32},{4},{264},{9},{8},{12},{20},{1},{8},{1},{8},{17},{3},{4},{13},{18},{20},{8},{8},{3},{1},{1},{13},{10},{6},{8},{3},{5},{4},{1},{10},{5},{1},{5},{10},{8},{7},{4},{17},{9},{18},{5},{3},{8},{5},{19},{24},{13},{7},{6},{4},{10},{18},{18},{8},{22},{23},{9},{20},{13},{36},{14},{8},{11},{1},{19},{7},{15},{16},{6},{9},{8},{3},{6},{7},{5},{9},{10},{15},{6},{10},{20},{7},{3},{17},{23},{28},{15},{13},{12},{13},{12},{13},{25},{28},{1},{7},{13},{9},{8},{7},{7},{25},{7},{8},{9},{14},{20},{5},{8},{8},{6},{4},{6},{9},{8},{3},{7},{10},{1},{4},{8},{7},{4},{7},{12},{4},{3},{9},{10},{4},{5},{9},{3},{7},{3},{8},{14},{7},{10},{9},{5},{5},{6},{3},{10},{8},{4},{13},{12},{14},{11},{10},{32},{28},{23},{18},{19},{23},{20},{14},{12},{5},{3},{10},{17},{11},{13},{7},{15},{14},{11},{12},{7},{6},{1},{9},{10},{11},{4},{12},{10},{12},{19},{5},{4},{5},{6},{6},{5},{10},{3},{1},{8},{5},{31},{4},{5},{10},{8},{16},{5},{30},{47},{6},{5},{5},{6},{4},{8},{8},{5},{6},{1},{3},{1023},{190},{205},{235},{84},{43},{100},{26},{227},{78},{152},{2},{2},{2},{629},{109}};
    #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (2903 bytes) */
const char* const cstring = "(\265/\375`.\036mZ\000Jk\274\022/\360t\224\003\314\3003\220V\365\326z\323\304\366\336\334J\332?m\"e\352\006la\226\253\260`DX\253\"\006W`\365\270\222\211\330\232L\245\005\032\001'\001\036\001\330\273\025\254h\220P\014\352\270'\341F\370\376\376\271\177!^'\347\311)\306\361_\010h}\251\206\325l\263\302HF~\035\231\253\303\366\014_\353\240\205\003B\276\214\177\361\213\320\322\320\327]\227\024=G\177iYl?\230\360@A%C\005Yw\326\276\366F\2740\337\361\300\327\375\006bY\003\001-\211\275f\013.\346q\361\253\355^\313*]\354\246\365\247\322F\030I%\\_\325$l \360\333\005[\227J#<\324.\010HI\253\330Cg\\\027\354\350Z\3630\300\r\014\300\nkY\363R\r\343\000\365\262\205\025\243\353\274\005\337ya7\2740\356wT\373\234\014\317vz\027\325m\323\331\014*\246\270\2245~\366\206\371\026\375k\021\354XXZ\3478\265\266\240\276*T|W\211a\357\357\244\255\016\025]1\302\021\\\177\370\215!S\017\3058\261\227\263\212q\360\320\350hw\207\007\307\344\343\2214\013\343p\351\216\324`\200\025\020\003-\340\204\302\004\t\021 <p\320\000\203\0014\t\317Q6p\220\234\261\217\341D\200\304\302\335$\306\024\351\262\221\024\266J!%\342\254>\212\254\337o3\2300\300\215\r\344H20tW\323xp\302Y\222\\\255E\351\030\223\370\21413\023\001p:n\301\002\211\013\221PB\333R\206\212\211\344\367\002\241\310d\236\003\370\371\214\310\006\305_{\027~&\265^\027\272}\311\214\324V\364\272\241\030grS)\375\355ts\356\255\330\327\365\246\007E\326\242\273^7\006\220AA\nZ\200Vh|<\231\037\017\207\202\214\215\214\211\0047\004\340D2\001 \201\330j\370\202\377\"\244L|#i\370\274\377i\001\236\336hz\354\302Z\233`\233\3062\020\307\307\203N?|\244F\303\207\275\016;\375\254\263^R\316\342j\024\263\334{H\351\276\257Hh\005\272\356\212\324zMb,a\337F\314\277\206\037\312\000c\374\330^\314&\361\303\r`\205n\335\213\034}\326\031\001E6\332\021\2640k\376\230J\030\211\240Z\036\001\261f}\363\273\"]\254\032\205:S\373\367\252\310v1\350\276\222\244\001\3512U;\316\262\275\264\225J\2671\236q\235~-\323c\233\334Jj\21233\225k\tq6Wq\367j\332r\231\036\361b\247\020\344>=W\255\245n\316\366?3?\243\020""\333\357C\325\223z\275-)#i\264\2226\3472^\322\264\317\277\227\314l\305H,#g\216v\253\263b\353\234\246\246\007\017$\334\264\037\226\025\001\"_b\014\234N%\363\302\230\265\232X\211\351\324\315\322[\361\016\353\274\331\225\341B\007\364\2571\306\033\244pD\334@D\003\263\367-\372\231\360D\202\024\226\210\010\241!OTHx`\340Z\255\331C\235.\332\216\300\307\271\326\326\307\025g.\215\332\272d\342\000\217\001\310z\237\263\237I\267]~|I\236\002\0220\022$\2206\324\273\002\005\033\313\370_k\244HOI\226nC*>jY\345A\201*>\036\244\240PL{]'\222\r\312\002\234`^\2477\361b\265\360Oob\305&\233\214\007A\n\244\374k\236\217_Z\223\261G9K\372I\317\266\327b\341I:s\317\214\223!-\277W\003\201H>\344\204T\245/\002\274\350x\341\212\275\026M\031:\253\243\243w+\253\243\323m\332\017oi\211]\212\351\206\225\3725_\021j;\255\337\027\203sx\316>k\036\214\273\261\320\017\235\347\305\221:uS\363\330\177\021\367\177\307N\2545k\330B~\335\227\277+\030\242t\355]\020\010\004\222\026\216\000\331\204 \307W4\272i*TP\020I\263w]B\334Wj\r\341,\006\002Q\332:J\010d]\243\007,\242\003\010\3205\351\365;R\234\263J\307\031?\220\022\204\007\211\024\310D\202\000;\025\307.8\236\321\335\214p\033\346\373\226r/\225]\224q\324\351\317Mk\314\376{~\217\036/\347\277\236\251\330\372\273\273\366\325\274\3258+-}-^\343\271+#\261coz\236\311d\227\271\337&\327\2347\253{\256\271k\254\261\314\306\030\263\347\250n\373\235h\263\311\326Smj\323N\216q\272\333\315\270\277\345RB\357\005\342p\r\210\223\2613\316t\337\367\372\036\203\014\250\302\213\030\203L\231\031\221\221\202$I:2\020\010\030\215Fy\242(\367\222y4&1\206\210!\204\030\"\"\"#\022\211H\220 I\222\244\003\335\nK\306\303\r\241\372)Is\352\370\351\031z'\245a0U\221w\335\007\340\237\017\002\213\252\303\007\216\274W\275\343h\315=\\\263\253+\360@/O\265\3400z\313\217v\242\032\344;\260A\024\2349\362\241\362\211V`\367\332\214|\366\251\272P\374\351\352n\240\204\241\021\207\315\251\032-8F\035\241\247\033\033`\000\340#06w\242\334\237Q\022\263\032b\301\233`J\031\250\007\316U)\365\236\032\020mL\255\357\253a<|^\352""\013U\036\240\013p\316\030\207\346\2212\223\276\240J\"\303\0224\347\376\331\324\272V2\322\356\tV\270T3\013\362#\370M\230\275\030\225\023\360\361\203\256\230\313l\335\314X\221\316,+\357\346sS\323b\265\347 \356\344!]\320&\300\266\307\037\235\245,*{\177*\020\224\3550\0065\327\352Z\306\376~P\204\300\231\215Hw\265\016\003v\r\2432\3353\303\321\207vD\020\004;\300\352\316\204O\260\0268\202\360\217\226r\240\030Y#\257\304\236\376\215k\311\263.;\333\333\240:\337\004y\257Bu-\r\340\344Z\345H\332D\345\3403\213\263\000\301Pc\334o\264\t \177\274\333\007hz9vI\227\017\207\217\3614t\240U\350*\365\202\223\322\010 \321s\365<\317<z\246>@\217\177?Ua\362\212\312\363\254n\3067\216\343\250\tm\037\364\016\301^f\314\001KL^\362:l\312\362\033\023\302Al\275\231P\2760\265_\217\207)\221\010\000\241\365V~\025}\344:\273l\227%\277\026\303\356\336\277A\315\364\021\274G\037\324\"7\212\006\006Y\256)\3233\034\254\360\000\252UBH\3507#^h\273\271wY\0007+\360i\346\321\275\277cH\376`\006\352z+,\031\301\255\000*\366 \3433\350b`5\005>\304B\260\307\363w\334\263\364\313\330r\311\023y\260\266}\210\267\335N\rCb\316\212\004\242\010\361\342\227\231J3\311\332'\3468.k\340p\246\216\212/\252\270po\335\321\241\221\310\276s\025\347w\371Z\331\364\"r[\256\t,8\204\n\014\255'P\245\2023\267\310\211\213\253\213ux=\320<f\307p\245\270\206\347\031\213\232I\324\300\r\362t\030\007q?{``<\312\374y\031\326\350\214sv\340\004\001Je;\357\273c\342\331\322|\346c\352\221\007\271\305\204\235\360\306\347\n!\027\216k\221\022\035\313r\304\361\351\234\253\366\326\311T\023:\263\325L\264{S\212\032\221\013\334\004Bx\273< \027xJ\321\200r\231`,\034\316\321\274%\211\000'(g\360\361\017\\\025\315\026\306X\205\312\n\032\222\315`\007\202\345bE\273\177F\207\375za;\262\260\323\350u\321x^\006W\2352\250\270\013\326d\177l\001\236\336\323Pr\2369\244P\236\347\007\352L\262\220\2579u\322\367\341\305\226>\340\224\321\3630\205\310k\222\010sR\346O\357\200P\364T\252\004\204\352X\245J\254\000\002`T\260\242\304U-\201.\334~\027\330\366?hj\323\274\374k\247\325\317\036\322""\007\025\024\261\026\362\"\304}\021Yl\344\357\2322\216\232\317SN\343_\341!\200S\006\215\221`@\020\262l\230\344\323\344%\333\262\241\341\356g\322\250\301\246D;\226\006\036\016\213\022\001\025\254v\346\246\364,t\240\337\364Fn\236\3724\301\325s;\206\3058\265\026.\324\334r\013\343\236f\005a\001\034\321\247\251z\\E\223\034\203\254\264\347]U*_\203G\322\270\363\005b\277\307\221[\017\304\003\204\260\006n\001y\243w\240\340b\373QBI\2728\007iS\224\244\025\320\034?\231\200s\031\300\035\263\030\307=\007\306\002\332\014\3021\263\014+T\304\251X\301M\266\362\"\275\221D\366R\0243\000\310\336\024}\002t\203 \006A\242\211\3763$\3726%\210\033e\324\345t^ \246\316\272\t\016\225\257\326fx\217\376\360\346-\325|;;\227\323\035\336\272\373<K\"qlQ\251\215\204 \333G\\\212i\246\212\375\343=\237\263<\032\220\337\351\327\235\344\212\370\266\222\026\0140\345\247t\021\216\203Y\010\n\010F\202\021\303\372\031\202Bc1\255\250\261\366\001\360e\255\224\0318$\227\001\216\013\245%\245\271\275\232\0245d\230\361c\375\020q\232\\\262\341\364\311?#\252\024\001\211\371x/\342yh\2052\321\326_\274\351K\352:\375\217\215\333\322^\334$A\"\346CN\307\005\025a@\300\235(\205\257\2548\022\020\337a.\020(o\3634\234\321t\354\250VD\325\360d;y\201\263Z\024\231\340\301\\j\326f~\013D{w\364\322\245\214h\355\327\355\0069E\252\320*v_\r\352\200\335$\031\266\n5?\276\342\231\240\212.\376\000\336\020\257\273\250\033\311G&5T\0350,\366\364\264\370\247\300\262\303\000\347$,>)\345\307\325\036\264G\357\360F\362\034D\217#\316\263R?jW\267\236\003(6GV\036.\030\305;\2261\211\014\006t\347eSc\325\345\005#\023Xg\233\363\3414\311K\221$\244\210b\005\2354Z\235=\037\265\002\346+0\350\235\204\330\267\240\354\242\306\343k\010x\324\017\370\355L\351/\030y\2042b\247\201~\351\227\230!\220\317\235\036\324\266\336\235i\364C\360\372\302\233\233\216\217v\363@z\250Iy\330B\031\203>u\004fE3\350#\347\372\327O\372\326\"\273\237\230\t15\205\2171\220\036\233\316E\221\214\223\313\270(\026\"}\237/\256\232\346@\034\345K\002\275\302\221\304Ff/\002\377'\317\271\002/M\214\371""\035\003\036\010\333\327\300\200\375\004\207,\270q\203|!\254V7w\373\251\342Dz\215\025r\212y\352x\010\343\355qJ\240\2606\261\253\277\020O\246cRzJ\360x\003\364\260h%N\013\r\235Q\000\room\036\035\205\r\201\370Z\014\"\006A\272\355\255_\352)\233\375\271 \214Z\010\240\331\224\305&/\231\204\rN`X\216\204\005B\373\026U\023\3622m\352\250&\277i\035\242v2\231\241C9\010\021\344V";
    PyObject *data = __Pyx_DecompressString(cstring, 2903, 3);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3151 bytes) */
const char* const cstring = "BZh91AY&SY\214Q~\344\000\001\230\377\240TP \000\177\377\377\377\277o\337\256\377\377\377\372\000@`\r{\354j\354\366\311<\215\355\315\343\017F\235I\355u\331h\314\315\017]\034\201\355\334z\255g6\302P\201\006\211\246\230A#S\365OI\3454\336\246I\351\250\r4z\203@i\265\017Q\352h\365\003\022Lj\r&DOMM40\206&\200\320i\223A\246\200\000\000\003@\022jz\215S\375\"\236\246A\220\320\000\000\000\000\000\r\003@$(\201\252y\023\312S=S\324\365<\247\352\2001\03142\003@\000\001\246\236\240\0074\304dd\323&\200d4d2d\000\000\014\21524\014!\220$D \320B4\233I\246\200(?SS#M\031\032\000\000\000\006&\351\334\301\235\005\301\0179\356\303\372U\231\002z\277F\245\006\214\217\367\022\343\353Y\022`\314?Z\321\302\245\242\020f\321\364\266x\217\351\365\311\274\322T?7\325\200\203\3750A\230\201\360\230Y\321\206\n\330A\002\323-Gz\244\227\245\243'\262*\222\354a\007*\252\213\261P\021\225\001E\2464\275\353\324\274\311Y?\352\016\331>\302\324\333M\367w[\237\001\261\311\305\010\211\203y]\313$\021\030Ml\325\336~9\350\215}\257\266\203sc\257\317\272\235\035\261&\216\314\213\323\014\240\252\223\007\027Wy\227\327\nCl\035\306\206,\366\016\2410\301F\312!\227\311\321\222\356d\216\250Bp\376\350\264\3062;j\004\346v.\006\300\324\304BMZ\341\023\304a\003I\306&5BoM$\014!\254\222\342\227\240\252Pa\267}\361nk\317\257\177T\263O%\264\2533F\022\014N\002\240,\016\313\243\216\201I\335\323\235\24773\nB\225\252\352\200\214\341A\255t9\341e9%Q\213\013\221\017\006\033yNdC\255\311\244\362#p\217\220\256sU\361\031\320\202wC\035l=\335\353k\257S5C2\314\345\036(\324\034\343\n\010\253\233;\330\353A\214\2165\221\324P\256\236\037B:\262\205\tY\n9Xp\371~\016\276^K,ww\253\027JP\324fA\000\260\004\223\370\334\342\244n\2266,\241\022\220\214\030\213d\376+\265\323:)\251Y\001T\350;\234\367\344\212\247L'W\357\303\351\312\035\033\315^^\035:Z\034\231U\233\353\205bE!\321\n\250#\307\250\250%L\n\255,\211\r\211\026n\245\r\376\026\370\272\360\353\373\241\236\242I\340D\021\310\274\310\202\365r\301\357\325\273\021\3065N\236{\263x6\345&\2645\271\355`\372\217\250/\362""\3541\033\362\334\245J\026\255\375xT\031q(\2346\242\032\372\365\2622\307,\364\036\033\217\253\317\362r\372\217\302\317N4\271B\326\263\003G\226\0279\355\031+\\\221\330(\267\261(\310\355\354\276\267\244\232\272V\206\342#\353\210\0024P\205\317=tO\013\350y<\232\267\335\027zz\320w\232\222\277\343\371\362CM\266\014m\241\215\255\014\377\305\370\366\353\324m\255\1777\215g_\r\026Y\354[>\232g\337k[\322D\372\245\247t\276K\001\345\377\251]>\240!J\021@M\013~>\312\237\355\227\252\253\367J\265\242\326\255\314\202\302L\234\212\360\372\3308\376\010\272\353J~\374\342\350\346\256\321\245\310\025pld\"u\210\250\211\0057\257\032\244J\371\n\351^xa;#\235\321\272\nG\213\307\010.FYQ]\3020\222TU\026Q!\020\035\350\270l\n:\313\270\010\030\320*HA\303\317(\252q\240|\317^\261\034\236\022\010k/\270\034\267\n#\317\252\260\214.DY\302\352\217\007\017!G\276\265\220\265v!\016\3544\266\363]\222\325A\2058MLF\026\227q\n\363\275R\337\2647\304\255\363\235lp1\243^\331\361*\256\314HI\357\254\271<\310\321\343.\005\263\016x\367\201\\\223\200\\ \311\345\334\357\225;'~Gn\357t\220\243\321\362\317`\350\316Q\035\321\334\270\337\262\370\032\272\200\337y\271\315%#p@\300\027\214\214\356m\244>\275\010B\220\021\020\311\263D\2214\335i\247M\242C\314\312\312T~\235\3525\302\304k\006\26532\337\213W\206\003{vMt\325\035\345\266\016\247\003\222\3053\247\335n\254\315\265\251\327\226\257\361\345\240\265E\222\326t\r_q\017\007\367\201^K\004\021\253(\014`Q\365c\355I\313\241w\361y\342\325C\024\214y\362\346}\325d\237\032h#B\232\364\357b\017\006\331Q}\022\035T\255~&\240\331\201B\000\352\232t\271\316a\276\341k\304\341\300.\013\361aR\335ZF)*\030\370\005\n\317M\312X\245\336\025E(=\2172'y\326\311a\353\204%\213\016Wg\241\213\237\234\272\014;#\304\261\200\037*\0019\002\301\247\222\305\361\205\226q$\2350\003\213q\205\020ALf}\037\314\246uQ]\000\323pF\205\004Y2\301E\303\302\374\205\367\232\263\270se_*0\201\250\215S\030Y\326\351*\360\314\204\307#\270\260!b\224\327\250u\3734\t\335\277\010\341)z\377|P\030\367`\227\354\001\360\24639\000.\"Ocx\024P""\245(\330g\313\260\233\306J\234\365\3710\363\272v\324\360\346$Z\332\346\272^\027G\272\027gY\033\214&\332R\224\202:\332\332E\320\227\004V\243\230\210d\372\342\332\230\363\003\004-p\261\323\010X\222\365\300j\014\326\204\307\301\231]\236'}\016\206&\216n\224D\020k\225\353\367*\222\260\325vQ@7\204\022d\204\004\014Sr\270e\226\017\260h\320!\311L\265\302\256\322\254\265\n\021\033{i#\267\325\230\346\"e\277&Xe\215\361\307\335\030M\240Zjk\252\227\220\226\001$1<\260\204C\004B\202U\010\0322`\246\256\010\335\244-)\010l\016\220\244\202\332\221\304\205\242C\212\0052f|\020\200\250\252\030S1D\310\352{X\242\265%<8p\315fI\0323\360\200,YP\215\324\314\371\373\265\353y\274\331\261L$\035n3 \267*\240\217\246v\343og\212\202\367\376\354\016\271\354\253\362\355\225\210\211\232\024%.\244\271\022\236~\327\230`\2739g\236\220U\300\336\224\204\357\026\355L\005j\305\353G;\234u\303\t\33017N\014A\251 \311T\204Z\2103\001\030\001\264\303H\331\245\257\016\365\025@\325\262\272\212\360\344At\273\025\321\252\243'*\355W_\230\341\356\035\023{\2528\247\315\376a+n\300>$\021\032\010Np\244m\273\327=\264\345uJ\023\025\007\226\334\355\317\305\310x\330ri\337\255\334wn4\030\032\366\257\210N\366\034\306`jB=\276\021\245\225`\006\273\360\256\335E\213\020\262\031\344\006\320\311\375!k\3222M>hr\366\314\330fc|\"\007X`\306Zgb\212\240\213\r\\\230\253\212\321$\323k\315H\215\230\024ryR\021\266\242L\367!\342\206\217\177i\346\236&\204z\222<\265K\302+9t1\010i\323E\266\372\311\373_o=%\224\311i\031W\033v\271\207\013\274{\344V*f\347WE9\360\331h\371\343\"\363\277\344\353%\321\315\223j\307\260\3548r\303\213\263+8'\343\221_\014\231\215;\030\333hM\214\313#\003\306\010\025\206%\356\367.\t'8\027\360\362w\352\205[\\\276>>\220\310k\177qT\227a\326\263\351\236(\210]-V3\267b\242\3644w\360\020\226;\252q\n3cd\212\302f\350\222\252[\260\233\372p\256D\352\244\241\033i\213E\025\006\230V\241\200t\361\302\354)2\206\342\227\220\363\004\352\331\347\005\034~E\0102\243\244\344\255\374\314\211;\310\310\215\221&(t\251\226\036\202\373I\356\313\031\027UZ\262""\212\252LM\n9.\320\365\313e\367FQ%\005\241\303\326\371\354Pf\345\253'\252p\006\320\263\326Et\235\005\310\316\206Ta\032\026\221\252)\031B!Kg;`,/g\214J\362\306T\034D\024m50\2530\343%N\016\010x}nk\247!A\366\014\2667\244h\350\324 \016\363-\346(-\373\260\367\203=\277\014g\231\030p\206\320\357\310\002$\270\354\251\031\211\205P\323h-C\311+J\230\316k\204\322\230\320ht\214<4J\317@\304\024\261\303\022\030\300z\302\231td!I\204m\211\265X\313Wn$\262\307\302\303\330\226\366:\370 \217I \342\n\307z\177_\331\304^\3426Q_8\321D\340p\214\247m \260@\233q3\310\021\202\2509\005\320\r\264|\363\002w\234\315\307Nw\365Wf%\307\037\273L\203\261<z\206\211\2100\017Y\323\220\220Y\016\31113ys\223y4\014\242\330j\251\254\360Yw\231(d\206\005\330\311\346\244I1$\223\350\364\346z>n\225\230\234\334\310\202\252\014\343,\346\005\307JQ%]\363\3202b\006\003\361\267\300\022+\215\035\217<\3263\r\020\323\340\223\324%\350\263\313kMs\007\234m\\B\377Gm\3135\261\302\357\323<\214\272\231\300bZ\365\207S\314{\2501\000\375I\247i\241\013\035\305!\033YB6\330\333\032m\215\260a\"\201 G\036;^TJ\271\264\270w\256EP\005\256\313\006(pA\002\230 \022\227'\253\257[\206\236S\315~Y\301\257\006\262\031\333M\356\251I\317\247\333\255\021\360.X\264\222\335f\324\262\275\r\221\035I\2400^\004`\273}\010\217\237\324\316\177\026\300u\361\014\337N;\010\344\320.68\264\020Kqq\313`\335\204\262\332%\333\362\244t\363W\313\333\301R\364\312'L\345\220\250a.IaB&\"O\300\263\024\320\3557\234\314|w\327[\227\025\353L-\241d\345\215R=\364\302}\026\341<\374\357\213\337\277\227P\231x\246(2\254p\271\317\317p\326`\013\261\260\361\272\t\251\344\201\254T\024\276k`\032k\210E\"+h\016'\210\0022\303r_\031IiK\330Y\215\254b\226&I3z&9R\205F\357|\014\034\267\177\362\225P\006\305e$\262z'F\t\031\2270\230\251\246Y\326\317\005\252/d\316\333\260l\360p\332\034\243\324\000\247\215dJ\210\016\302\255\242\205\221\024m\321\367ATk\204\315\254J*\210$\353\316\021J\266\252\362$\247\266\256\200e\204A\276\366\307\220\263DT\244\006\3144\254'\215$-H\245\027\276c\000\333jM\020\010\263\305\300""\211\014\200\213<\021\254\006uC04\254\234s\300\354\206.1\306\270S\rr\321\034\322\033\325do]\363Qz4\256\027\251]\333+\027\342&\334Cwu3{Y]\001Q.X\233\245\220\"\010\244\020\022Q\245\2458\035\001`}(YY\342\224\026\346\323\315\364\312\032\303\353N\264\245\276\036XW\001\203y\014!\232\036_\207\374M$\006\002\"\314\010\334mF+\352[\025._\t\272\331\314\332d\232\026\303\217F\361\270\243\203N^\330\211;\352\224\030i\334\261\014D\203\t\024E\213Uc\032\003\246p[\251\301H\220\204\005`Y|Iujr\213\254\265`\014\341=\021M\364\034\330\027\233\271!a-\330\330$\214\320\327\017\230JC%\220\001\211\330`e\304\272\371u\253J\266\322BiQ\236\006#\263@\324|\031\016a\022\235\256\215\304\000U.\022\031|PW\310\231\"\n\216\232f\024\356\326\230\207\314\320\323@\025;\276?)\271\211v\222\027D\214\331\354\205\371\023i}O\263\370H\322\374\215\002\033i\321\364\260\343C\342\254:l]U\210\330\371r\314ol\204\006\314\303t \230\306\344m\360.\242g\034)p\257\356\277\373\377\027rE8P\220\214Q~\344";
    PyObject *data = __Pyx_DecompressString(cstring, 3151, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (2902 bytes) */
const char* const cstring = "x\332\265Y\353\222\0237\026\366\357\374\3337PX\210mb:\220\220\31323\244&\023RKm\200\251@6\265\225M\t\271[\266\225i\267z%\365\330\306\345\367\310\343\356w\216\324\276\315\030\206\\\246\240[:\272\235\353w\216\332\375\354\376\203O?{\370\371\027_~\365\217\276\370Z<\020\217\304\375cy\352\306O\253\221\355-W\375\307g\247\316\251\305\361\331\323\252\320s\355\326\r!MU\234\251JT6\210\306k\3215]\241\274P\242VNMu\300\224\noL\241\031\271\362A(\332J\024*(1rv*\322\230\257unF\013\321\265M\340=\2066Lh#\353M0\266R\245PU!.\364bf]\201]\306\315TW\341\311\034\353\202.\204\017\316Tca\235(\rN\031\241\021\026\2650\005&\231\221\321.{Z]\252\322\320\026\256\322%\363\365H\334\272\343o}om-\274y\243\205\361\242\201d9V\025\331s\255\213\304-6;{\231\253R91\006\257\317\255\310m\241!\247\323\020*\237`\342P\347\2124\220\333imJE,\323v\205\036i\3470\336\200\215R\204\211\026#\343\210\301\246\312y\022\266-\263\347\266\322\317m\320\230\240\2028[\204I\273\2744C\355T\320\345\202E\314I\245\230T\211\363'\347\367\036~\365\220\265\342\364\257\320\202\027\276\031\346\245\362\036\254\331\221\0306\246\014\246\"=h\237\211\247#\261\260\215\250H\254`a!\277\263\000\254U\302\353\300<v\331(,\205\304rh\266+\n\343p\210\271\324\264\372;Uz\235\275h`\270\211\252YsS\343\247*\2202@\256\233\260\266\021\206\032H<\204r\232z\221U\005+\365\312$b\363\3553\311\024\255\235~l\355t|\336\272\332\332]\305\271\206\226T\236k\2108!_\322\220M\021\363\212|E5\301\202UC\252_d;\263\331\003\324\245\202\t\207\245\306\3020\243\265\320\tl[\350K\203Y\331K\366U\203\235\272\304N\0276\254\210i\330\277\020\266\202\251\314H`o2\002i3\311\301\356\322uj\326\315^.\252\240\346\002\256a\335#q\307\277\022r6\321N\277\022\246\272S\274\022\010\002\274&\355\221\202\007y\257\270\223\323\336\220\003\366h\216\251H=l\345\366\304\344\343\271m\312\202\203sH\323\242+B\340R+\317\354\212\327Y\364_\311\016\375\032\223|\320\252\310h\337\030\212\241\251\313d\227\211\202\361\365\034\212\204\210\360X\001\273\271\205\250\241\276\206\374\231\330\006+\307\362\025xy\246j\261\\=\246\346""\256wd\260\335Eeg\325:\230)\010\177r\026\341\273\361\206;>R\252f\212\000 \2716c\024\334\313\017\335\n>\035\326\036\243\r\004\007}E\321\212go\006B\342\310\367\007\210\206 \306\360\336\n\203Y\334\233=\256\367A\277\327\027\037\236\210^\377\010\313N0|t\357\361r%\345ru\374:\373Z\014\004z\240\016\216> /\001\303\0044\210\001R\264k\240\234\256W#\335\3150\330L\033\304\276~M\0223\2525um\035\371\334B\007U\024\022D\rA\344\005\200\363\204eP\341\372\331\303\322\346\027\222\335\275\025q\354\264Z\307\377\033\355l\016\263\001W\306\215m<\3576`\214\005\177']\214`U|2\377\024\032G\251\037V\342\243eE\322J\370\243D\363g\202\362l\254C\257\377\313QN\232\341\r9\016q\212\323\231\214N\225\311\027u\217\310\2370\371\223\226\\/\346\037\210\364'e\364[)\341PA\310\211\251\345\320\332R\022w\275\222t\317\017\032\234\367\305r\275\220\376.-\301g\251yT\201\305\007G;\343\210\255\336\\\234\234\210\373}\036\276\277;\354th\034\242}C]\255[\205\361\024\326\335\201(XB\202\335b-\253\256hp\020\243R\222C\237\240\323&\030\002\013\306\204-\332n\322\031\347\003N\017\0149\246\202v\0100\223\227\255\327\354)\303\214z\037\262\r\"\000l\233\241/\330\272U\243\217x\026O\330&\002*\266\347\033J\312\362\263O\345\320\204\350\016&\245<\3447\343%\333\236\351}\316-f\004@@@\305<L\336\2347\216\t\tuz\306G\235\024K\312\226\360 SIx\257_-\021W\2615\020\377\275\273\274\230q\273O\263\370\200\2520\323\330h\246k\007Bl\004\023\361k\004\200\215i\310L\311\345\267\2475\300\211\311\225\031\375\253\020\000\036\020\225\342\223\001\265Nz\375u\223\314\312\010\032\021\254\r\037\225\260\2147\002\027>\202\003\264\203\014[\025?\017\304rSm\254~\301v\342\347\270\341\022i\\\201\373\325/\260T\324`\206X,{\364*\232\374@\300\247\301C\021>\020\016\233\233J\237\334\273\347Cq\222\177\374\361\203/\337\025\232\244\021\366\347\333Kr,\004Z^\372U\354\200KY\203\257)L\266J\223v\373z\016\374\250\304\255\263[\210\321qi\207\252D\214^Z\370\310\355dc,\241\204\nk\256\343\362\366\262D\211D[\327\2536\254\376^;5\236*dKg\221\351\036$\362\331\217\347\377\221\337\275\370\241g\006""\\\034f\004`\275\376v\214G2\2441\375M\214\336^\262\025H\367\353#V\353\343\325\010lKb\"\r\306\241u\344&\341\305qLC\335;\276\373x f1\201\240\002\202\263TPuv\332V\265\337\264\025\354\223R\223C\315\340\351\377b\034\003\272\341\237\337)*\316\265\203\277MU\225\353\237\224\303\206c)\317\027s\374\377\026\005\231|\016\255\376\240G\257\364\264&\360o\263\337\217\337\177/\225$\320o\335`#\206\252kMU\301\030I\331z\362FrH57~\270\301\375\010\022\234\237\t|$\013\207R\203\201#\341|>QNJ\256\341$<\304\004=M]\3329/\341]\320\267\014N\345z\250\362\213\274\264\236<&\226\251\3321\322\347M\241^A\210\306\351\027C\252$e\300& Jf\013\033\200\357\221\"<gj\336\004]y\353\220\356jg\013\274|3\245\224\260\311\026W\363\3066\305s-M\024\322\017\277\2119\250\304gtB\246js\r\025\265\260\347m\230\013\3113 \264L\365U\2420\314\324e\333\265\227\300s\024KRoL\235X\2123\346\331F\236\335\267\264u!c\231)cP\310\344i\004\006\351%\223%\344^\037\030*M\221\362\240)\220\022\311Wda\363\302\241\014q2\2768\375h\340\037W\371\233\324\003\207\223\032\246O\231\224\375/`\004~0U\376\002-\317\305\371\004\361]\300\247\240\321\261\256\220e\0344BJ\241\352\277\2208\201\347\021\345\032\005\034 S1\310c,\265$W\342.\361J(\261\335\346\001\340\177M.+\251\347\003E\201\0347(\250e\202\270\275\036e\034\311\242_7`\370\322\201\0227\245\233\364\212\013\320\211\266X\317B\262\311\351\305\225\251\304j\203gv\314:\361\217\263\244\026r\342\261vm\036\304\233T\010\273\241E)\371KY\227 x\311)\263\325\004IHA\345\343\343\215\276\320\272Fr\363q\234\312\270\230\374\326\010)a\037\260\206g=\325S\313J\231\332\002u\242\224\025+L\246g\364ZJ\225\350\350\031?\206\213\240Qa\322\346\363\000\244\251\254\214\005\r*\307*rNH\306\371r\215\230\266\366\266\246\006e\26463\267\357\2505\352\321\264&\331\224[\254\276Z\341>\312\2648P\333z\223\005\333\354Aa\216\377ST\257q\225\224\010\034\270zm\244Lm\240\324\005p \366\222\017P\223\255\314\255\246BX_@\021WQww|\007}\367\306Z\010\337'\003\267\257P\374>)A\363\036\231\2015\322.\003\325;$\323\377\032UFCq\036\346\022-\0029\215\246V\3167\365u""\227\034c\335A-\206&_\217\361\262e\303\267i:\212\273\227:Z\306\243G\260A\355dj.SRD8\2521k\357\211\023\3626@g\240,\002o\3334Q\246\001`<A!s\214V\213F\324N\306\330j\267|3w\344\326\276.Q4\0062w,j\343\261\315\020\221\022\000\2070,\366\302\233\236\023ggH)\213\035\350\030\232J\201\224\330f\243\323cS\244p\013Q\261_\251D\355\307'\320\021\251o\\)\312E2\202\036\211\370\326\321+\241\336\324\005\t\tFJ\004s\243\371\341\021\246\325,\246oj\327/!\366L\253\013\037\013\353\371\033S\237/b\376\023w{\233f\277s-y \016\265\223\333\313\207\234\177>\347\234\007x\311c\222b\225\313\366f\366\321\241mnt\352\0378\tpx\243#\370\376\026C\372\002(\211\033TM\327\370\001\335}\232\274\035\003\374D\260\331\343\244\315'|q\215V\024w\327K\030bx\335MY\271\251\310\037\335h\303\367\021\201\323\\jG\240|\267 \007t\267?\347\240\331w\371\033\376\272\313\332C~\256\213\237!}\322i\265t\360\344\233\251\357\317q8\234FJk\253\334\330[\247%\316\364\255\356\366\007\351\333MRsg\333y:r\350\254*\250\304\352\\\265Hg\253>\232\350y\207\363\261\263\364a\217\267\355\304$%Qp9\031?\370u\266\241\373\200\313\334\330\345H\3530Z\361\350\321%\226Zw|\216a.\213\302c\261\t\303w\3178l\276\265\370\314E'\356\"5%\253\003\334\337\304\t\377\274\200\217\225\375N\261x NRE\273\311\017\235\355E\357+\014_ao\204\316\177D\276/R\315\212j\200R\236\031\311\364\205\205\213\376\003\202\222X\274\254s\375\262\rs\235Ng'\245\222\213\226T\343Y\327:*\327\020{\364T:oS\267\367\244\253#sMwE\277\327\225\303},:\250b\366\356\203\243\220\362[\276\251\234;\252K\203\321~\213\266a'9\010s\200r\004\373u\322_[\210\353\352\322\340\346NZ\350\304\313\317i@12D\025r\206[+\275T\255\206\006\005\313\342\231\372\325\272w\3172\025f\361\335\352\314\342\0320\017O\375\267(e\234]\350\"\322\323\217C?\2402k\\\256\377\251\252\242\324;C\377\246\"\"R\236\241\256w\213\323\222\312\0162H\244\322\317\010\247\014*\247%]\312\026O\342\267\263\267\353\255\035M\031\231\235\245\2753\302\033x\213m\300J\030\363;\022\303\357\315&\327\363=\215\320\2075C\333\240,\375\355\364\267\277\375\246\016\234\361\220/""\354_\265\277y\311g|\037\372\023\201'r\237>j\304\354\301\337M\016\204\344\357PE\357/\250\360\376(\033\007\215\363\027m\374\036\246\210\237y\257\327\376U3u\326\314\320\345\275C\367\334K`\010\261N_\243\342\304k\276Gu\342w\334\267J\2736K\373\233\365\335\336\373V1&\256d\346\376\017\242\317\2378";
    PyObject *data = __Pyx_DecompressString(cstring, 2902, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (7982 bytes) */
const char* const bytes = ").0123456789) ? 1 : 0<_ArgInfo({})>CArray<CIndexer<CIndexer _indCan not use 'i' as a parameter nameCannot cast array data from Cannot specify 'out' as both a positional and keyword argumentExpected string or list for typ identifier.Invalid kernel name: \"%s\"Loop size is undecided.Need array or CScalar got No codes are cached because compilation is deferred until the first function call.NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Out shape is mismatchedOutput arguments must be cupy.ndarrayOutput arguments type must be cupy.ndarrayOutput array size is Undecided<ParameterInfo({})> Peer access has been activated automatically. Peer access is unavailable between these devices.Specified 'size' can be used only if all of the ndarray are 'raw'.Syntax error: %sT _whereT in%dT out%dThe device where the array resides (The input types of the kernel could not be inferred. Please use `.cached_codes` instead.The 'out' tuple must have exactly one entry per ufunc output<_TypeMap {}>Type is mismatched. Unknown keyword \"%s\"Wrong arguments %sWrong number of arguments for {!r}. It must be either {} or {} (with outputs), but given {}.Wrong type (\n)() != ();{} = {};->{}__{}<`.? , >{} {},;\n according to the rule 'safe'.accumulate` is not supported yetadd_notearg_kind={!r}.at` is not supported yetblock_size must be greater than zeroc_contiguous={!r}, casting='const const {} {}({});const {t} &{n} = _raw_{n}[_ind.get()];ctype={!r}cupy._core._kernel._Op(cupy/_core/_kernel.pyx\n        __device__ int _hip_bool_cast(long long int x) {\n            volatile int a = 1;\n            if (x == 0) a = 0;\n            return a;\n        }\n        disable', dtype=Nonedtype={!r}enable, error_func=, expected callable , expected string or listgc, got  has incorrect type (expected _hip_bool_cast(if(!_raw__where[_ind.get()]) continue;if(!_where) continue;in%d[_ind.g""et()]index_32_bits={!r}invalid op is_const={!r}) is different from the current device (isenabled{name}({in_args}{out_args}, \\*{kwargs})name={!r}ndim={!r}numpy._core.multiarray failed to importnumpy._core.umath failed to import) of arguments for out{}, /, out=(), /, out=Noneout%d'out' must be a tuple of arraysoutput operand[, {positional}], / [, out={default}]raw={!r}).real().reduce` is not supported yet.reduceat` is not supported yet, routine=--std=c++17{t} &{n} = _raw_{n}[_ind.get()]; to \n    ${type_decls}${typedef_preamble}\n    ${preamble}\n    extern \"C\" __global__ void ${name}(${params}) {\n      ${loop_prep};\n      #pragma unroll 1\n      CUPY_FOR(i, _ind.size()) {\n        _ind.set(i);\n        ${operation};\n      }\n      ${after_loop};\n    }\n    type={!r}typedef <ufunc '%s'>, wrong nin or nout.A_ArgInfoBCIndexerElementwiseKernel_Op_OpsParameterInfoPerformanceWarning__Pyx_PyDict_NextRefTemplate_TypeMapULL_a_add_reduceatafter_loopappendarginfosarrarrayaxisbblock_sizebool_ccachecall_ufunccan_castcastingchar__class_getitem__classinfocline_in_tracebackcloseclscompilerctypecudaTextureObject_t__cuda_array_interface__cuda_cutensorcumprodcumsumcupycupy._corecupy._core._kernelcupy._core._scalarcupy_addcupy_backends.cuda.apicupy_backends.cuda.libscupy.cuda__cupy_get_ndarray__cupy_multiply__cupy_override_elementwise_kernel__cupyx.cutensorcutensorcutensor_opd_decide_params_typedefaultdefault_casting_default_castingdev_iddevice_id__dict__docdriver_driverdtypeenumerateerror_funcfor_each_deviceformat_full_mask_fusion_thread_localgenexprgetget_build_version_get_elementwise_kernel_get_elementwise_kernel_code_get_param_info_get_typenameget_typename_get_warpsize__getstate__guess_routine_guess_routine_from_dtype_guess_routine_from_in_typesiin_argsin_args_dtypein_paramsin_typesindicesinexact__init__.<locals>.genexprintegeris_constis_fusing_is_hip_7_plusis_valid_kernel_nameitemsitemsizekeepdimskernelkindkwargsloop_prep__main__mapmemoize__module__nname__name__ndarrayndim__""new__newbyteordernextninno_return_non_constnoutnumpyoperationopsoptionsoutout_argsout_args_dtypeout_opsout_paramsout_typespairsparamparamspoppositionalpreambleprodpromote_types__pyx_capi____pyx_checksum__pyx_state__pyx_type__pyx_unpickle_ElementwiseKernel__pyx_unpickle_ParameterInfo__pyx_unpickle__ArgInfo__pyx_unpickle__Op__pyx_unpickle__Ops__pyx_unpickle__TypeMap__pyx_unpickle_ufunc__pyx_vtable____qualname___raw_raw__reduce____reduce_cython__reduce_dims__reduce_ex__reshaperesolution_funcresolve_dtypesresult_typereturn_tupleroutinerstripssame_kindscatter_op_scatter_opsend__set_name__setdefault__setstate____setstate_cython__shapesizesplitstreamstringstripsubstitutesumt__test__throw_try_elementwise_binary_routinetype_typetype_declstype_maptypedef_preambleufunc_ufunc_doc_signature_formatter_ufunc_doc_signature_formatter.<locals>.genexprupdate_utilvaluevalueswarnwarningswarpSizeweaks_wherexzipPyObject *(PyObject *)\000PyObject *(PyObject *, PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, PyObject *)\000PyObject *(PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, int)\000PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_kernel_create_ufunc *__pyx_optional_args)\000PyObject *(PyObject *, PyObject *, int, __pyx_t_4cupy_5_core_7_carray_shape_t &)\000PyObject *(PyObject *, PyObject *, struct __pyx_opt_args_4cupy_5_core_7_kernel__get_kernel_params *__pyx_optional_args)\000PyObject *(int __pyx_skip_dispatch)\000PyObject *(int, PyObject *)\000PyObject *(struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int, int __pyx_skip_dispatch)\000__pyx_t_4cupy_5_core_7_carray_shape_t (PyObject *, PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &)\000_get_arginfos\000_get_out_args_from_optionals\000_get_out_args_with_params\000create_ufunc\000_broadcast\000_get_kernel_params\000_full_mask_hex\000_preprocess_args\000_check_peer_access\000_reduce_dimsPyObject *(PyObjec""t *, __pyx_t_4cupy_5_core_7_carray_shape_t &)\000int (std::vector<Py_ssize_t>  const &, std::vector<Py_ssize_t>  const &, int __pyx_skip_dispatch)\000_broadcast_core\000vector_equalPyObject *(PyObject *, int __pyx_skip_dispatch)\000PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_7_scalar_get_typename *__pyx_optional_args)\000format_type_decls\000get_typenamePyObject *(PyObject *, int __pyx_skip_dispatch)\000void (PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_6_dtype__raise_if_invalid_cast *__pyx_optional_args)\000get_dtype\000_raise_if_invalid_castPyObject *\000\000\000_elementwise_accelerators\000_reduction_accelerators\000_routine_acceleratorsPyObject *\000\000all_type_chars\000all_type_chars_bPyObject *(int, int __pyx_skip_dispatch)\000int (int __pyx_skip_dispatch)\000getDeviceProperties\000getDevicePyObject *\000scalar_type_setint\000\000\000\000\000\000\000\000_is_hip_environment\000deviceAttributeComputeCapabilityMajor\000deviceAttributeComputeCapabilityMinor\000errorContextIsDestroyed\000errorInvalidResourceHandle\000errorInvalidValue\000errorMemoryAllocation\000errorPeerAccessAlreadyEnabledint (int __pyx_skip_dispatch)\000int (int, int)\000get_device_id\000_enable_peer_accessint (struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, struct __pyx_obj_4cupy_5_core_4core__ndarray_base *, int __pyx_skip_dispatch)\000may_share_bounds\230A\230\021\230astruct __pyx_obj_4cupy_4cuda_8function_Module *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_compile_with_cache *__pyx_optional_args)\000struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(PyObject *, __pyx_t_4cupy_5_core_7_carray_shape_t const &, PyObject *, PyObject *)\000struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(PyObject *, int __pyx_skip_dispatch)\000struct __pyx_obj_4cupy_5_core_4core__ndarray_base *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4cupy_5_core_4core_array *__p""yx_optional_args)\000compile_with_cache\000_ndarray_init\000_convert_object_with_cuda_array_interface\000arraystruct __pyx_obj_4cupy_5_core_7_carray_Indexer *(__pyx_t_4cupy_5_core_7_carray_shape_t const &)\000_indexer_init";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 327; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 119) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 327; i < 343; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 343; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 327;
      for (Py_ssize_t i=0; i<16; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        #if PY_VERSION_HEX < 0x030E0000
        if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
        #else
        if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
        #endif
        {
          Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        }
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0;
    int8_t const cint_constants_1[] = {0,-1,1};
    int16_t const cint_constants_2[] = {128};
    int32_t const cint_constants_4[] = {17460680L,27370516L,70000000L,75976750L,129642355L,202451496L,216642581L,264656072L};
    int64_t const cint_constants_8[] = {4294967295LL};
    for (int i = 0; i < 13; i++) {
      numbertab[i] = PyLong_FromLongLong((i < 3 ? cint_constants_1[i - 0] : (i < 4 ? cint_constants_2[i - 3] : (i < 12 ? cint_constants_4[i - 4] : cint_constants_8[i - 12]))));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<13; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      #if PY_VERSION_HEX < 0x030E0000
      if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
      #else
      if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
      #endif
      {
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      }
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 1;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 1;
    unsigned int nlocals : 1;
    unsigned int flags : 10;
    unsigned int first_line : 11;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1209};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cupy__core__kernel_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__24, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1212};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cupy__core__kernel_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__24, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1503};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cupy__core__kernel_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1513};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_cupy__core__kernel_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
      #endif
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectFastCall */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* RaiseException */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* HasAttr */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        Py_INCREF(values[i]);
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        Py_INCREF(src[i]);
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return PyLong_FromLong(-intval);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a - b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla - llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) - (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
}
#endif

/* PyDictVersioning (used by GetModuleGlobalName) */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    Py_INCREF(key);
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyObjectCallOneArg (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywordsImpl (used by ParseKeywords) */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos = NULL;
    #else
    Py_ssize_t pos = 0;
    #endif
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (
        #if CYTHON_AVOID_BORROWED_REFS
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
        #else
        PyDict_Next(kwds, &pos, &key, NULL)
        #endif
    ) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        #endif
    }
    __Pyx_END_CRITICAL_SECTION();
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(pos);
    #endif
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* ArgTypeTestFunc (used by ArgTypeTest) */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
    int from_annotation_subclass = 0;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (!exact) {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    } else if (exact == 2) {
        if (__Pyx_TypeCheck(obj, type)) {
            from_annotation_subclass = 1;
            extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
        }
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")"
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        "%s%U"
#endif
        , name, type_name, obj_type_name
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        , (from_annotation_subclass ? ". " : ""), extra_info
#endif
        );
#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    if (exact == 2 && from_annotation_subclass) {
        PyObject *res;
        PyObject *vargs[2];
        vargs[0] = PyErr_GetRaisedException();
        vargs[1] = extra_info;
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
        Py_XDECREF(res);
        PyErr_SetRaisedException(vargs[0]);
    }
#endif
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *pos = NULL;
#else
        Py_ssize_t pos = 0;
#endif
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL);
#if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(pos);
#endif
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_bint(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_bint(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* PyObjectCall2Args (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}
#endif

/* PyObjectCallMethod1 (used by append) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!j)) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* SliceTupleAndList */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (length <= 0) {
        return PyList_New(0);
    }
    return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(src);
    result = __Pyx_PyList_GetSlice_locked(src, start, stop);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
#endif // CYTHON_COMPILING_IN_CPYTHON

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    const char* function_name,
    PyObject *kw)
{
#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments)
    CYTHON_UNUSED_VAR(function_name);
    CYTHON_UNUSED_VAR(kw);
    return 0;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
#if PY_VERSION_HEX >= 0x03090000
        CYTHON_UNUSED_VAR(function_name);
#else
        Py_ssize_t kwsize;
        #if CYTHON_ASSUME_SAFE_SIZE
        kwsize = PyTuple_GET_SIZE(kw);
        #else
        kwsize = PyTuple_Size(kw);
        if (unlikely(kwsize < 0)) return -1;
        #endif
        for (Py_ssize_t pos = 0; pos < kwsize; pos++) {
            PyObject* key = NULL;
            #if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
            #else
            key = PyTuple_GetItem(kw, pos);
            if (unlikely(!key)) return -1;
            #endif
            if (unlikely(!PyUnicode_Check(key))) {
                PyErr_Format(PyExc_TypeError,
                    "%.200s() keywords must be strings", function_name);
                return -1;
            }
        }
#endif
    } else {
        if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1;
    }
    return 0;
#endif
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    int was_initialized =  __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return __Pyx_CallCFunction(cfunc, self, arg);
        } else if (flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1);
        } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, NULL);
        }
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod1(&tmp_cfunc, self, arg);
    }
#endif
    PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *args = PyTuple_New(1);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
    } else
#endif
    {
        result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg);
    }
    return result;
}

/* py_dict_pop */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)
    PyObject *value;
    if (PyDict_Pop(d, key, &value) == 0) {
        if (default_value) {
            Py_INCREF(default_value);
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
        value = default_value;
    }
    return value;
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    return _PyDict_Pop(d, key, default_value);
#else
    if (default_value) {
        return __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, d, key, default_value);
    } else {
        return __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, d, key);
    }
#endif
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* dict_getitem_default */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* dict_setdefault */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
    PyObject* value;
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
    PyDict_SetDefaultRef(d, key, default_value, &value);
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    PyObject *args[] = {d, key, default_value};
    value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#elif CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* IterNextPlain (used by IterNext) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
    if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
        __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
    return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    PyObject *result;
    PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
    if (unlikely(!next)) return NULL;
    result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
    return result;
#else
    (void)__Pyx_GetBuiltinName; // only for early limited API
    iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
    assert(iternext);
    return iternext(iterator);
#endif
}

/* IterNext */
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(iterator));
    PyErr_Format(PyExc_TypeError,
        __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
    __Pyx_DECREF_TypeName(iterator_type_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
#if !CYTHON_COMPILING_IN_LIMITED_API
    iternextfunc iternext = __Pyx_PyObject_TryGetSlot(iterator, tp_iternext, iternextfunc);
    if (likely(iternext)) {
        next = iternext(iterator);
        if (likely(next))
            return next;
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
    #endif
    } else if (CYTHON_USE_TYPE_SLOTS) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else
#endif
    if (unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    } else {
        next = defval ? PyIter_Next(iterator) : __Pyx_PyIter_Next_Plain(iterator);
        if (likely(next))
            return next;
    }
    return __Pyx_PyIter_Next2Default(defval);
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) a *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
    Py_DECREF(new_exc);
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n)))
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* ImportImpl (used by Import) */
static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
    PyObject *imported_module = PyImport_GetModule(qualname);
    if (unlikely(!imported_module)) {
        *module = NULL;
        if (PyErr_Occurred()) {
            return -1;
        }
        return 0;
    }
    *module = imported_module;
    return 1;
}
static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
    PyObject *imported_module;
    PyObject *top_level_package_name;
    Py_ssize_t i;
    int status, module_found;
    Py_ssize_t dot_index;
    module_found = __Pyx__Import_GetModule(qualname, &imported_module);
    if (unlikely(!module_found || module_found == -1)) {
        *module = NULL;
        return module_found;
    }
    if (imported_names) {
        for (i = 0; i < len_imported_names; i++) {
            PyObject *imported_name = imported_names[i];
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
            int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
#else
            int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
            if (unlikely(has_imported_attribute == -1)) goto error;
#endif
            if (!has_imported_attribute) {
                goto not_found;
            }
        }
        *module = imported_module;
        return 1;
    }
    dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
    if (dot_index == -1) {
        *module = imported_module;
        return 1;
    }
    if (unlikely(dot_index == -2)) goto error;
    top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
    if (unlikely(!top_level_package_name)) goto error;
    Py_DECREF(imported_module);
    status = __Pyx__Import_GetModule(top_level_package_name, module);
    Py_DECREF(top_level_package_name);
    return status;
error:
    Py_DECREF(imported_module);
    *module = NULL;
    return -1;
not_found:
    Py_DECREF(imported_module);
    *module = NULL;
    return 0;
}
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *from_list = 0;
    int module_found;
    if (!qualname) {
        qualname = name;
    }
    module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
    if (likely(module_found == 1)) {
        return module;
    } else if (unlikely(module_found == -1)) {
        return NULL;
    }
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (imported_names) {
#if CYTHON_COMPILING_IN_CPYTHON
        from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
        if (unlikely(!from_list))
            goto bad;
#else
        from_list = PyList_New(len_imported_names);
        if (unlikely(!from_list)) goto bad;
        for (Py_ssize_t i=0; i<len_imported_names; ++i) {
            if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
        }
#endif
    }
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, moddict, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, moddict, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(from_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* SliceObject */
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
    __Pyx_TypeName obj_type_name;
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyLong_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyLong_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s",
        obj_type_name, value ? "assignment" : "deletion");
    __Pyx_DECREF_TypeName(obj_type_name);
bad:
    return -1;
}

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON
static int
__Pyx_unicode_modifiable(PyObject *unicode, int unsafe_shared)
{
    if (!__Pyx_IS_UNIQUELY_REFERENCED(unicode, unsafe_shared))
        return 0;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030F0000
    if (PyUnstable_Unicode_GET_CACHED_HASH(unicode) != -1)
        return 0;
#endif
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left, unsafe_shared)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PySequenceMultiply */
#if CYTHON_USE_TYPE_SLOTS
static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) {
    PyObject *result, *pymul = PyLong_FromSsize_t(mul);
    if (unlikely(!pymul))
        return NULL;
    result = PyNumber_Multiply(seq, pymul);
    Py_DECREF(pymul);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) {
    PyTypeObject *type = Py_TYPE(seq);
    if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) {
        return type->tp_as_sequence->sq_repeat(seq, mul);
    } else {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}
#endif

/* AllocateExtensionType */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
    if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
        allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
        return alloc_func(t, 0);
    } else {
        newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (!tp_new) {
            PyObject *new_str = PyUnicode_FromString("__new__");
            if (likely(new_str)) {
                PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                Py_DECREF(new_str);
                return o;
            } else
                return NULL;
        } else
    #endif
        return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
    }
}

/* CallTypeTraverse */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
    if (__Pyx_get_runtime_version() < 0x03090000) return 0;
    #endif
    if (!always_call) {
        PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
        unsigned long flags = PyType_GetFlags(base);
        if (flags & Py_TPFLAGS_HEAPTYPE) {
            return 0;
        }
    }
    Py_VISIT((PyObject*)Py_TYPE(o));
    return 0;
}
#endif

/* FunctionExport */
static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) {
    PyObject *cobj;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    tmp.fp = f;
    cobj = PyCapsule_New(tmp.p, sig, 0);
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(api_dict, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(cobj);
    return -1;
}

/* GetApiDict */
static PyObject *__Pyx_ApiExport_GetApiDict(void) {
    PyObject *d;
    if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1)
        return NULL;
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0)
            goto bad;
    }
    return d;
bad:
    Py_XDECREF(d);
    return NULL;
}

/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
    PyObject *tp_dictoffset_o;
    Py_ssize_t tp_dictoffset;
    tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
    if (unlikely(!tp_dictoffset_o)) return -1;
    tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
    Py_DECREF(tp_dictoffset_o);
    if (unlikely(tp_dictoffset == 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' doesn't have a dictoffset");
        return -1;
    } else if (unlikely(tp_dictoffset < 0)) {
        PyErr_SetString(
            PyExc_TypeError,
            "'type' has an unexpected negative dictoffset. "
            "Please report this as Cython bug");
        return -1;
    }
    return tp_dictoffset;
}
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
    static Py_ssize_t tp_dictoffset = 0;
    if (unlikely(tp_dictoffset == 0)) {
        tp_dictoffset = __Pyx_GetTypeDictOffset();
        if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
            tp_dictoffset = 0; // try again next time?
            return NULL;
        }
    }
    return *(PyObject**)((char*)tp + tp_dictoffset);
}
#endif

/* SetItemOnTypeDict (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_SetItem(tp_dict, k, v);
    if (likely(!result)) {
        PyType_Modified(tp);
        if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
            PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
            if (!setNameResult) return -1;
            Py_DECREF(setNameResult);
        }
    }
    return result;
}

/* FixUpExtensionType */
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
#if __PYX_LIMITED_VERSION_HEX > 0x030900B1
    CYTHON_UNUSED_VAR(spec);
    CYTHON_UNUSED_VAR(type);
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#else
    const PyType_Slot *slot = spec->slots;
    int changed = 0;
#if !CYTHON_COMPILING_IN_LIMITED_API
    while (slot && slot->slot && slot->slot != Py_tp_members)
        slot++;
    if (slot && slot->slot == Py_tp_members) {
#if !CYTHON_COMPILING_IN_CPYTHON
        const
#endif  // !CYTHON_COMPILING_IN_CPYTHON)
            PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
        while (memb && memb->name) {
            if (memb->name[0] == '_' && memb->name[1] == '_') {
                if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_weaklistoffset = memb->offset;
                    changed = 1;
                }
                else if (strcmp(memb->name, "__dictoffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_dictoffset = memb->offset;
                    changed = 1;
                }
#if CYTHON_METH_FASTCALL
                else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                    assert(memb->type == T_PYSSIZET);
                    assert(memb->flags == READONLY);
                    type->tp_vectorcall_offset = memb->offset;
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
#if !CYTHON_COMPILING_IN_PYPY
                else if (strcmp(memb->name, "__module__") == 0) {
                    PyObject *descr;
                    assert(memb->type == T_OBJECT);
                    assert(memb->flags == 0 || memb->flags == READONLY);
                    descr = PyDescr_NewMember(type, memb);
                    if (unlikely(!descr))
                        return -1;
                    int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                    Py_DECREF(descr);
                    if (unlikely(set_item_result < 0)) {
                        return -1;
                    }
                    changed = 1;
                }
#endif  // !CYTHON_COMPILING_IN_PYPY
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
#if !CYTHON_COMPILING_IN_PYPY
    slot = spec->slots;
    while (slot && slot->slot && slot->slot != Py_tp_getset)
        slot++;
    if (slot && slot->slot == Py_tp_getset) {
        PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
        while (getset && getset->name) {
            if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                PyObject *descr = PyDescr_NewGetSet(type, getset);
                if (unlikely(!descr))
                    return -1;
                #if CYTHON_COMPILING_IN_LIMITED_API
                PyObject *pyname = PyUnicode_FromString(getset->name);
                if (unlikely(!pyname)) {
                    Py_DECREF(descr);
                    return -1;
                }
                int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                Py_DECREF(pyname);
                #else
                CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                #endif
                Py_DECREF(descr);
                if (unlikely(set_item_result < 0)) {
                    return -1;
                }
                changed = 1;
            }
            ++getset;
        }
    }
#else
    CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
#endif  // !CYTHON_COMPILING_IN_PYPY
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallMethod0 (used by PyType_Ready) */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[1] = {obj};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_CallNoArg;
    return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
#endif
}

/* ValidateBasesTuple (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_SIZE
    n = PyTuple_GET_SIZE(bases);
#else
    n = PyTuple_Size(bases);
    if (unlikely(n < 0)) return -1;
#endif
    for (i = 1; i < n; i++)
    {
        PyTypeObject *b;
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *b0 = PySequence_GetItem(bases, i);
        if (!b0) return -1;
#elif CYTHON_ASSUME_SAFE_MACROS
        PyObject *b0 = PyTuple_GET_ITEM(bases, i);
#else
        PyObject *b0 = PyTuple_GetItem(bases, i);
        if (!b0) return -1;
#endif
        b = (PyTypeObject*) b0;
        if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
        {
            __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
            PyErr_Format(PyExc_TypeError,
                "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
            __Pyx_DECREF_TypeName(b_name);
#if CYTHON_AVOID_BORROWED_REFS
            Py_DECREF(b0);
#endif
            return -1;
        }
        if (dictoffset == 0)
        {
            Py_ssize_t b_dictoffset = 0;
#if CYTHON_USE_TYPE_SLOTS
            b_dictoffset = b->tp_dictoffset;
#else
            PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
            if (!py_b_dictoffset) goto dictoffset_return;
            b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
            Py_DECREF(py_b_dictoffset);
            if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
#endif
            if (b_dictoffset) {
                {
                    __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                    PyErr_Format(PyExc_TypeError,
                        "extension type '%.200s' has no __dict__ slot, "
                        "but base type '" __Pyx_FMT_TYPENAME "' has: "
                        "either add 'cdef dict __dict__' to the extension type "
                        "or add '__slots__ = [...]' to the base type",
                        type_name, b_name);
                    __Pyx_DECREF_TypeName(b_name);
                }
#if !CYTHON_USE_TYPE_SLOTS
              dictoffset_return:
#endif
#if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(b0);
#endif
                return -1;
            }
        }
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(b0);
#endif
    }
    return 0;
}
#endif

/* PyType_Ready */
CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
    while (t) {
        PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
        if (bases) {
            return 1;
        }
        t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
    }
    return 0;
}
static int __Pyx_PyType_Ready(PyTypeObject *t) {
#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
    (void)__Pyx_PyObject_CallMethod0;
#if CYTHON_USE_TYPE_SPECS
    (void)__Pyx_validate_bases_tuple;
#endif
    return PyType_Ready(t);
#else
    int r;
    if (!__Pyx_PyType_HasMultipleInheritance(t)) {
        return PyType_Ready(t);
    }
    PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
    if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
        return -1;
#if !defined(PYSTON_MAJOR_VERSION)
    {
        int gc_was_enabled;
    #if PY_VERSION_HEX >= 0x030A00b1
        gc_was_enabled = PyGC_Disable();
        (void)__Pyx_PyObject_CallMethod0;
    #else
        PyObject *ret, *py_status;
        PyObject *gc = NULL;
        #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                !CYTHON_COMPILING_IN_GRAAL
        gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
        #endif
        if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
        if (unlikely(!gc)) return -1;
        py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
        if (unlikely(!py_status)) {
            Py_DECREF(gc);
            return -1;
        }
        gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
        Py_DECREF(py_status);
        if (gc_was_enabled > 0) {
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
            if (unlikely(!ret)) {
                Py_DECREF(gc);
                return -1;
            }
            Py_DECREF(ret);
        } else if (unlikely(gc_was_enabled == -1)) {
            Py_DECREF(gc);
            return -1;
        }
    #endif
        t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#if PY_VERSION_HEX >= 0x030A0000
        t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
#endif
#else
        (void)__Pyx_PyObject_CallMethod0;
#endif
    r = PyType_Ready(t);
#if !defined(PYSTON_MAJOR_VERSION)
        t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
    #if PY_VERSION_HEX >= 0x030A00b1
        if (gc_was_enabled)
            PyGC_Enable();
    #else
        if (gc_was_enabled) {
            PyObject *tp, *v, *tb;
            PyErr_Fetch(&tp, &v, &tb);
            ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
            if (likely(ret || r == -1)) {
                Py_XDECREF(ret);
                PyErr_Restore(tp, v, tb);
            } else {
                Py_XDECREF(tp);
                Py_XDECREF(v);
                Py_XDECREF(tb);
                r = -1;
            }
        }
        Py_DECREF(gc);
    #endif
    }
#endif
    return r;
#endif
}

/* DelItemOnTypeDict (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
    int result;
    PyObject *tp_dict;
#if CYTHON_COMPILING_IN_LIMITED_API
    tp_dict = __Pyx_GetTypeDict(tp);
    if (unlikely(!tp_dict)) return -1;
#else
    tp_dict = tp->tp_dict;
#endif
    result = PyDict_DelItem(tp_dict, k);
    if (likely(!result)) PyType_Modified(tp);
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
            if (likely(reduce_cython)) {
                ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred()) {
        __Pyx_TypeName type_obj_name =
            __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
        PyErr_Format(PyExc_RuntimeError,
            "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
        __Pyx_DECREF_TypeName(type_obj_name);
    }
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetVTable */
static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
    if (unlikely(!ob))
        goto bad;
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#else
    if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
#endif
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* GetVTable (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type) {
    void* ptr;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#else
    PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
#endif
    if (!ob)
        goto bad;
    ptr = PyCapsule_GetPointer(ob, 0);
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* MergeVTables */
static int __Pyx_MergeVtables(PyTypeObject *type) {
    int i=0;
    Py_ssize_t size;
    void** base_vtables;
    __Pyx_TypeName tp_base_name = NULL;
    __Pyx_TypeName base_name = NULL;
    void* unknown = (void*)-1;
    PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
    int base_depth = 0;
    {
        PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        while (base) {
            base_depth += 1;
            base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
        }
    }
    base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
    base_vtables[0] = unknown;
#if CYTHON_COMPILING_IN_LIMITED_API
    size = PyTuple_Size(bases);
    if (size < 0) goto other_failure;
#else
    size = PyTuple_GET_SIZE(bases);
#endif
    for (i = 1; i < size; i++) {
        PyObject *basei;
        void* base_vtable;
#if CYTHON_AVOID_BORROWED_REFS
        basei = PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto other_failure;
#else
        basei = PyTuple_GET_ITEM(bases, i);
#endif
        base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
        if (base_vtable != NULL) {
            int j;
            PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
            for (j = 0; j < base_depth; j++) {
                if (base_vtables[j] == unknown) {
                    base_vtables[j] = __Pyx_GetVtable(base);
                    base_vtables[j + 1] = unknown;
                }
                if (base_vtables[j] == base_vtable) {
                    break;
                } else if (base_vtables[j] == NULL) {
                    goto bad;
                }
                base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
            }
        }
    }
    PyErr_Clear();
    PyMem_Free(base_vtables);
    return 0;
bad:
    {
        PyTypeObject* basei = NULL;
        PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
        tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
#if CYTHON_AVOID_BORROWED_REFS
        basei = (PyTypeObject*)PySequence_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#elif !CYTHON_ASSUME_SAFE_MACROS
        basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
        if (unlikely(!basei)) goto really_bad;
#else
        basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
#endif
        base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
#if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(basei);
#endif
    }
    PyErr_Format(PyExc_TypeError,
        "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
really_bad: // bad has failed!
#endif
    __Pyx_DECREF_TypeName(tp_base_name);
    __Pyx_DECREF_TypeName(base_name);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
other_failure:
#endif
    PyMem_Free(base_vtables);
    return -1;
}

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_2_5
#define __PYX_HAVE_RT_ImportType_3_2_5
static PyTypeObject *__Pyx_ImportType_3_2_5(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_5 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    if (size == 0) {
        return (PyTypeObject *)result;
    }
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize+itemsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_5 &&
            ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd-%zd from PyObject",
            module_name, class_name, size, basicsize, basicsize+itemsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_5 && (size_t)basicsize > size) {
        if (PyErr_WarnFormat(NULL, 0,
                "%.200s.%.200s size changed, may indicate binary incompatibility. "
                "Expected %zd from C header, got %zd from PyObject",
                module_name, class_name, size, basicsize) < 0) {
            goto bad;
        }
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* PxdImportShared (used by VoidPtrImport) */
#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_5
#define __PYX_HAVE_RT_ImportFromPxd_3_2_5
static int __Pyx_ImportFromPxd_3_2_5(PyObject *module, const char *name, void **p, const char *sig, const char *what) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, "__pyx_capi__");
    if (!d)
        goto bad;
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
    PyDict_GetItemStringRef(d, name, &cobj);
#else
    cobj = PyDict_GetItemString(d, name);
    Py_XINCREF(cobj);
#endif
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C %.8s %.200s",
                PyModule_GetName(module), what, name);
        goto bad;
    }
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(d);
    Py_XDECREF(cobj);
    return -1;
}
#endif

/* VoidPtrImport */
#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_5
#define __PYX_HAVE_RT_ImportVoidPtr_3_2_5
static int __Pyx_ImportVoidPtr_3_2_5(PyObject *module, const char *name, void **p, const char *sig) {
    return __Pyx_ImportFromPxd_3_2_5(module, name, p, sig, "variable");
}
#endif

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction_3_2_5
#define __PYX_HAVE_RT_ImportFunction_3_2_5
static int __Pyx_ImportFunction_3_2_5(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    int result = __Pyx_ImportFromPxd_3_2_5(module, funcname, &tmp.p, sig, "function");
    if (result == 0) {
        *f = tmp.fp;
    }
    return result;
}
#endif

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        const char* module_name_str = 0;
        PyObject* module_name = 0;
        PyObject* module_dot = 0;
        PyObject* full_name = 0;
        PyErr_Clear();
        module_name_str = PyModule_GetName(module);
        if (unlikely(!module_name_str)) { goto modbad; }
        module_name = PyUnicode_FromString(module_name_str);
        if (unlikely(!module_name)) { goto modbad; }
        module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__22);
        if (unlikely(!module_dot)) { goto modbad; }
        full_name = PyUnicode_Concat(module_dot, name);
        if (unlikely(!full_name)) { goto modbad; }
        #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                CYTHON_COMPILING_IN_GRAAL
        {
            PyObject *modules = PyImport_GetModuleDict();
            if (unlikely(!modules))
                goto modbad;
            value = PyObject_GetItem(modules, full_name);
        }
        #else
        value = PyImport_GetModule(full_name);
        #endif
      modbad:
        Py_XDECREF(full_name);
        Py_XDECREF(module_dot);
        Py_XDECREF(module_name);
    }
    if (unlikely(!value)) {
        PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
    }
    return value;
}

/* CLineInTraceback (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
#else
PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
    PyObject **dict_ptr = _PyObject_GetDictPtr(o);
    return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
}
#endif
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    PyObject *cython_runtime_dict;
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
    cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, cython_runtime_dict,
            __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
    }
    if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    Py_XDECREF(cython_runtime_dict);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache (used by AddTraceback) */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
    __Pyx_CachedCodeObjectType* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = code_cache->entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__find_code_object;
    return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
    if (old_count < 0) {
        __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
        return NULL;
    }
#endif
    __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
#endif
    return result;
#endif
}
static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
{
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            code_cache->entries = entries;
            code_cache->max_count = 64;
            code_cache->count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
    if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
        __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_INCREF(code_object);
        Py_DECREF(tmp);
        return;
    }
    if (code_cache->count == code_cache->max_count) {
        int new_max = code_cache->max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        code_cache->entries = entries;
        code_cache->max_count = new_max;
    }
    for (i=code_cache->count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    code_cache->count++;
    Py_INCREF(code_object);
}
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
    (void)__pyx__insert_code_object;
    return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
#else
    struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_nonatomic_int_type expected = 0;
    if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
        return;
    }
#endif
    __pyx__insert_code_object(code_cache, code_line, code_object);
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
#endif
#endif
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                       PyObject *firstlineno, PyObject *name) {
    PyObject *replace = NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
    if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
    replace = PyObject_GetAttrString(code, "replace");
    if (likely(replace)) {
        PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
        Py_DECREF(replace);
        return result;
    }
    PyErr_Clear();
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
    PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
    PyObject *exc_type, *exc_value, *exc_traceback;
    int success = 0;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
    }
    PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
    code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!code_object) {
        code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
        if (unlikely(!code_object)) goto bad;
        py_py_line = PyLong_FromLong(py_line);
        if (unlikely(!py_py_line)) goto bad;
        if (c_line) {
            py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        } else {
            py_funcname = PyUnicode_FromString(funcname);
        }
        if (unlikely(!py_funcname)) goto bad;
        dict = PyDict_New();
        if (unlikely(!dict)) goto bad;
        {
            PyObject *old_code_object = code_object;
            code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
            Py_DECREF(old_code_object);
        }
        if (unlikely(!code_object)) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
    } else {
        dict = PyDict_New();
    }
    getframe = PySys_GetObject("_getframe");
    if (unlikely(!getframe)) goto bad;
    if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
    frame = PyEval_EvalCode(code_object, dict, dict);
    if (unlikely(!frame) || frame == Py_None) goto bad;
    success = 1;
  bad:
    PyErr_Restore(exc_type, exc_value, exc_traceback);
    Py_XDECREF(code_object);
    Py_XDECREF(py_py_line);
    Py_XDECREF(py_funcname);
    Py_XDECREF(dict);
    Py_XDECREF(replace);
    if (success) {
        PyTraceBack_Here(
            (struct _frame*)frame);
    }
    Py_XDECREF(frame);
}
#else
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    if (c_line) {
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
    }
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    Py_XDECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_mstate_global->__pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
#endif

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CheckUnpickleChecksum */
static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
    PyObject *pickle_module = PyImport_ImportModule("pickle");
    if (unlikely(!pickle_module)) return;
    PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError");
    Py_DECREF(pickle_module);
    if (unlikely(!pickle_error)) return;
    if (checksum2 == checksum1) {
        PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))",
            checksum, checksum1, members);
    } else if (checksum3 == checksum2) {
        PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))",
            checksum, checksum1, checksum2, members);
    } else {
        PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))",
            checksum, checksum1, checksum2, checksum3, members);
    }
    Py_DECREF(pickle_error);
}
static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
    int found = 0;
    found |= checksum1 == checksum;
    found |= checksum2 == checksum;
    found |= checksum3 == checksum;
    if (likely(found))
        return 0;
    __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members);
    return -1;
}

/* Declarations */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = (float)(1.0) / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = (float)(1.0) / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if ((b.imag == 0) && (a.real >= 0)) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = (double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = (double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if ((b.imag == 0) && (a.real >= 0)) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
      return ::std::complex< long double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
      return x + y*(__pyx_t_long_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
      __pyx_t_long_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
#else
    static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
        __pyx_t_long_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
        __pyx_t_long_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
        __pyx_t_long_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsl(b.real) >= fabsl(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                long double r = b.imag / b.real;
                long double s = (long double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_long_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            long double r = b.real / b.imag;
            long double s = (long double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_long_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            long double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_long_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) {
        __pyx_t_long_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) {
        __pyx_t_long_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtl(z.real*z.real + z.imag*z.imag);
          #else
            return hypotl(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
            __pyx_t_long_double_complex z;
            long double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    long double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_long__double(a, a);
                    case 3:
                        z = __Pyx_c_prod_long__double(a, a);
                        return __Pyx_c_prod_long__double(z, a);
                    case 4:
                        z = __Pyx_c_prod_long__double(a, a);
                        return __Pyx_c_prod_long__double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if ((b.imag == 0) && (a.real >= 0)) {
                    z.real = powl(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2l(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_long__double(a);
                theta = atan2l(a.imag, a.real);
            }
            lnr = logl(r);
            z_r = expl(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosl(z_theta);
            z.imag = z_r * sinl(z_theta);
            return z;
        }
    #endif
#endif

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_4cupy_5_core_7_kernel__ArgKind neg_one = (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1, const_zero = (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE enum __pyx_t_4cupy_5_core_7_kernel__ArgKind __Pyx_PyLong_As_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum __pyx_t_4cupy_5_core_7_kernel__ArgKind neg_one = (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1, const_zero = (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        enum __pyx_t_4cupy_5_core_7_kernel__ArgKind val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
        val = __Pyx_PyLong_As_enum____pyx_t_4cupy_5_core_7_kernel__ArgKind(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) >= 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) >= 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) >= 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)-1)*(((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 2 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) ((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)-1)*(((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 3 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) ((((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) (((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)-1)*(((((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) - 1 > 4 * PyLong_SHIFT)) {
                            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) ((((((((((enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, long, PyLong_AsLong(x))
        } else if ((sizeof(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_4cupy_5_core_7_kernel__ArgKind, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        enum __pyx_t_4cupy_5_core_7_kernel__ArgKind val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums");
        val = (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
#endif
        if (unlikely(ret))
            return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum __pyx_t_4cupy_5_core_7_kernel__ArgKind");
    return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum __pyx_t_4cupy_5_core_7_kernel__ArgKind");
    return (enum __pyx_t_4cupy_5_core_7_kernel__ArgKind) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyLong_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (int) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        int val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (int) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (int) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((int) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (int) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyLong_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (long) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(long) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        long val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (long) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (long) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (long) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (long) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((long) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((long) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (long) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!PyLong_Check(x))) {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyLong_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
    if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
        if (unlikely(__Pyx_PyLong_IsNeg(x))) {
            goto raise_neg_overflow;
        } else if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_DigitCount(x)) {
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
        }
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
        if (unlikely(Py_SIZE(x) < 0)) {
            goto raise_neg_overflow;
        }
#else
        {
            int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
            if (unlikely(result < 0))
                return (size_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(size_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
        } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(size_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
        } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
        }
    }
    {
        size_t val;
        int ret = -1;
#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
        Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
            x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
        if (unlikely(bytes_copied == -1)) {
        } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
            goto raise_overflow;
        } else {
            ret = 0;
        }
#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
        int one = 1; int is_little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        ret = _PyLong_AsByteArray((PyLongObject *)x,
                                    bytes, sizeof(val),
                                    is_little, !is_unsigned);
#else
        PyObject *v;
        PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
        int bits, remaining_bits, is_negative = 0;
        int chunk_size = (sizeof(long) < 8) ? 30 : 62;
        if (likely(PyLong_CheckExact(x))) {
            v = __Pyx_NewRef(x);
        } else {
            v = PyNumber_Long(x);
            if (unlikely(!v)) return (size_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (size_t) -1;
            }
            is_negative = result == 1;
        }
        if (is_unsigned && unlikely(is_negative)) {
            Py_DECREF(v);
            goto raise_neg_overflow;
        } else if (is_negative) {
            stepval = PyNumber_Invert(v);
            Py_DECREF(v);
            if (unlikely(!stepval))
                return (size_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (size_t) 0;
        mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
        shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
        for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
            PyObject *tmp, *digit;
            long idigit;
            digit = PyNumber_And(stepval, mask);
            if (unlikely(!digit)) goto done;
            idigit = PyLong_AsLong(digit);
            Py_DECREF(digit);
            if (unlikely(idigit < 0)) goto done;
            val |= ((size_t) idigit) << bits;
            tmp = PyNumber_Rshift(stepval, shift);
            if (unlikely(!tmp)) goto done;
            Py_DECREF(stepval); stepval = tmp;
        }
        Py_DECREF(shift); shift = NULL;
        Py_DECREF(mask); mask = NULL;
        {
            long idigit = PyLong_AsLong(stepval);
            if (unlikely(idigit < 0)) goto done;
            remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((size_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
                goto raise_overflow;
            if (is_negative)
                val = ~val;
        }
        ret = 0;
    done:
        Py_XDECREF(shift);
        Py_XDECREF(mask);
        Py_XDECREF(stepval);
#endif
        if (unlikely(ret))
            return (size_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        unsigned char *bytes = (unsigned char *)&value;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
        if (is_unsigned) {
            return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
        } else {
            return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
        }
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
        int one = 1; int little = (int)*(unsigned char *)&one;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
#else
        int one = 1; int little = (int)*(unsigned char *)&one;
        PyObject *from_bytes, *result = NULL, *kwds = NULL;
        PyObject *py_bytes = NULL, *order_str = NULL;
        from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
        if (!from_bytes) return NULL;
        py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
        if (!py_bytes) goto limited_bad;
        order_str = PyUnicode_FromString(little ? "little" : "big");
        if (!order_str) goto limited_bad;
        {
            PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
            if (!is_unsigned) {
                kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                if (!kwds) goto limited_bad;
                if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
            }
            result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
        }
        limited_bad:
        Py_XDECREF(kwds);
        Py_XDECREF(order_str);
        Py_XDECREF(py_bytes);
        Py_XDECREF(from_bytes);
        return result;
#endif
    }
}

/* UpdateUnpickledDict */
static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
    PyObject *state_dict = __Pyx_PySequence_ITEM(state, index);
    if (unlikely(!state_dict)) {
        return -1;
    }
    int non_empty = PyObject_IsTrue(state_dict);
    if (non_empty == 0) {
        Py_DECREF(state_dict);
        return 0;
    } else if (unlikely(non_empty == -1)) {
        return -1;
    }
    PyObject *dict;
    #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
    dict = PyObject_GetAttrString(obj, "__dict__");
    #else
    dict = PyObject_GenericGetDict(obj, NULL);
    #endif
    if (unlikely(!dict)) {
        Py_DECREF(state_dict);
        return -1;
    }
    int result;
    if (likely(PyDict_CheckExact(dict))) {
        result = PyDict_Update(dict, state_dict);
    } else {
        PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict);
        if (likely(obj_result)) {
            Py_DECREF(obj_result);
            result = 0;
        } else {
            result = -1;
        }
    }
    Py_DECREF(state_dict);
    Py_DECREF(dict);
    return result;
}
static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
    Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(state_size == -1)) return -1;
    #endif
    if (state_size <= index) {
        return 0;
    }
    return __Pyx__UpdateUnpickledDict(obj, state, index);
}

/* FormatTypeName */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
static __Pyx_TypeName
__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
{
    PyObject *module = NULL, *name = NULL, *result = NULL;
    #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
    name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_qualname);
    #else
    name = PyType_GetQualName(tp);
    #endif
    if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
    module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                               __pyx_mstate_global->__pyx_n_u_module);
    if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
    if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
        result = name;
        name = NULL;
        goto done;
    }
    result = PyUnicode_FromFormat("%U.%U", module, name);
    if (unlikely(result == NULL)) goto bad;
  done:
    Py_XDECREF(name);
    Py_XDECREF(module);
    return result;
  bad:
    PyErr_Clear();
    if (name) {
        result = name;
        name = NULL;
    } else {
        result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__23);
    }
    goto done;
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* GetRuntimeVersion */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
void __Pyx_init_runtime_version(void) {
    if (__Pyx_cached_runtime_version == 0) {
        const char* rt_version = Py_GetVersion();
        unsigned long version = 0;
        unsigned long factor = 0x01000000UL;
        unsigned int digit = 0;
        int i = 0;
        while (factor) {
            while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                ++i;
            }
            version += factor * digit;
            if (rt_version[i] != '.')
                break;
            digit = 0;
            factor >>= 8;
            ++i;
        }
        __Pyx_cached_runtime_version = version;
    }
}
#endif
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    return __Pyx_cached_runtime_version;
#endif
}

/* AddModuleRef */
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
      PyObject *module_dict = PyImport_GetModuleDict();
      PyObject *m;
      if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
          return NULL;
      }
      if (m != NULL && PyModule_Check(m)) {
          return m;
      }
      Py_XDECREF(m);
      m = PyModule_NewObject(name);
      if (m == NULL)
          return NULL;
      if (PyDict_CheckExact(module_dict)) {
          PyObject *new_m;
          (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
          Py_DECREF(m);
          return new_m;
      } else {
           if (PyObject_SetItem(module_dict, name, m) != 0) {
                Py_DECREF(m);
                return NULL;
            }
            return m;
      }
  }
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *py_name = PyUnicode_FromString(name);
      if (!py_name) return NULL;
      PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
      Py_DECREF(py_name);
      return module;
  }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif

/* FetchSharedCythonModule (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* FetchCommonType (used by CommonTypesMetaclass) */
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
    if (result && metaclass) {
        PyObject *old_tp = (PyObject*)Py_TYPE(result);
    Py_INCREF((PyObject*)metaclass);
#if __PYX_LIMITED_VERSION_HEX >= 0x03090000
        Py_SET_TYPE(result, metaclass);
#else
        result->ob_type = metaclass;
#endif
        Py_DECREF(old_tp);
    }
    return result;
}
#else
#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
#endif
static int __Pyx_VerifyCachedType(PyObject *cached_type,
                               const char *name,
                               Py_ssize_t expected_basicsize) {
    Py_ssize_t basicsize;
    if (!PyType_Check(cached_type)) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s is not a type object", name);
        return -1;
    }
    if (expected_basicsize == 0) {
        return 0; // size is inherited, nothing useful to check
    }
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
    if (unlikely(!py_basicsize)) return -1;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = NULL;
    if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
#else
    basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
#endif
    if (basicsize != expected_basicsize) {
        PyErr_Format(PyExc_TypeError,
            "Shared Cython type %.200s has the wrong size, try recompiling",
            name);
        return -1;
    }
    return 0;
}
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
    PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
    int get_item_ref_result;
    const char* object_name = strrchr(spec->name, '.');
    object_name = object_name ? object_name+1 : spec->name;
    py_object_name = PyUnicode_FromString(object_name);
    if (!py_object_name) return NULL;
    abi_module = __Pyx_FetchSharedCythonABIModule();
    if (!abi_module) goto done;
    abi_module_dict = PyModule_GetDict(abi_module);
    if (!abi_module_dict) goto done;
    get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
    if (get_item_ref_result == 1) {
        if (__Pyx_VerifyCachedType(
              cached_type,
              object_name,
              spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else if (unlikely(get_item_ref_result == -1)) {
        goto bad;
    }
    cached_type = __Pyx_PyType_FromMetaclass(
        metaclass,
        CYTHON_USE_MODULE_STATE ? module : abi_module,
        spec, bases);
    if (unlikely(!cached_type)) goto bad;
    if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
    new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
    if (unlikely(new_cached_type != cached_type)) {
        if (unlikely(!new_cached_type)) goto bad;
        Py_DECREF(cached_type);
        cached_type = new_cached_type;
        if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
            goto bad;
        }
        goto done;
    } else {
        Py_DECREF(new_cached_type);
    }
done:
    Py_XDECREF(abi_module);
    Py_DECREF(py_object_name);
    assert(cached_type == NULL || PyType_Check(cached_type));
    return (PyTypeObject *) cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CommonTypesMetaclass (used by CoroutineBase) */
static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
#if __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
    PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
    return NULL;
}
static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
    PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
    return -1;
}
#endif
static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
    {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
    {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
    #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
    {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
    {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
    #endif
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT,
    __pyx_CommonTypesMetaclass_slots
};
static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    PyObject *bases = PyTuple_Pack(1, &PyType_Type);
    if (unlikely(!bases)) {
        return -1;
    }
    mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
    Py_DECREF(bases);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* SwapException (used by CoroutineBase) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
  #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
  #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* ReturnWithStopIteration (used by CoroutineBase) */
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
    if (value == Py_None) {
        if (async || !iternext)
            PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
        return;
    }
    __Pyx__ReturnWithStopIteration(value, async);
}
static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
#if CYTHON_COMPILING_IN_CPYTHON
    __Pyx_PyThreadState_declare
#endif
    PyObject *exc;
    PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
#if CYTHON_COMPILING_IN_CPYTHON
    if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
        if (PY_VERSION_HEX >= (0x030e00A1)) {
            exc = __Pyx_PyObject_CallOneArg(exc_type, value);
        } else {
            PyObject *args_tuple = PyTuple_New(1);
            if (unlikely(!args_tuple)) return;
            Py_INCREF(value);
            PyTuple_SET_ITEM(args_tuple, 0, value);
            exc = PyObject_Call(exc_type, args_tuple, NULL);
            Py_DECREF(args_tuple);
        }
        if (unlikely(!exc)) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    #if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    #if CYTHON_USE_EXC_INFO_STACK
    if (!__pyx_tstate->exc_info->exc_value)
    #else
    if (!__pyx_tstate->exc_type)
    #endif
    {
        Py_INCREF(exc_type);
        __Pyx_ErrRestore(exc_type, exc, NULL);
        return;
    }
    #endif
#else
    exc = __Pyx_PyObject_CallOneArg(exc_type, value);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(exc_type, exc);
    Py_DECREF(exc);
}

/* CoroutineBase (used by Generator) */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#endif // CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE void
__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
#if CYTHON_USE_AM_SEND
    gen->yieldfrom_am_send = NULL;
#endif
    Py_CLEAR(gen->yieldfrom);
}
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    CYTHON_UNUSED_VAR(__pyx_tstate);
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
        else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
            #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
            value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
            if (unlikely(!value)) goto limited_api_failure;
            #else
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            #endif
            Py_DECREF(ev);
        }
        else if (unlikely(PyTuple_Check(ev))) {
            Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely(tuple_size < 0)) {
                Py_XDECREF(tb);
                Py_DECREF(ev);
                Py_DECREF(et);
                return -1;
            }
            #endif
            if (tuple_size >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#elif CYTHON_ASSUME_SAFE_MACROS
                value = PySequence_ITEM(ev, 0);
#else
                value = PySequence_GetItem(ev, 0);
                if (!value) goto limited_api_failure;
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
#else
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
#endif
    Py_DECREF(ev);
#if CYTHON_COMPILING_IN_LIMITED_API
    if (unlikely(!value)) return -1;
#endif
    *pvalue = value;
    return 0;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  limited_api_failure:
    Py_XDECREF(et);
    Py_XDECREF(tb);
    Py_XDECREF(ev);
    return -1;
#endif
}
static CYTHON_INLINE
__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
    if (*retval) {
        return PYGEN_NEXT;
    } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
        return PYGEN_RETURN;
    } else {
        return PYGEN_ERROR;
    }
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_CLEAR(exc_state->exc_value);
#else
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
#endif
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
    const char *msg;
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    CYTHON_MAYBE_UNUSED_VAR(closing);
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
    if (unlikely(self->resume_label == -1)) {
        __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
        return PYGEN_ERROR;
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_value) {
        #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        #else
        PyObject *exc_tb;
        #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
        exc_tb = PyException_GetTraceback(exc_state->exc_value);
        #elif PY_VERSION_HEX >= 0x030B00a4
        exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
        #else
        exc_tb = exc_state->exc_traceback;
        #endif
        if (exc_tb) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
            #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
            Py_DECREF(exc_tb);
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    retval = self->body(self, tstate, value);
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    *result = retval;
    if (self->resume_label == -1) {
        return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED_VAR(exc_state);
#else
    PyObject *exc_tb;
    #if PY_VERSION_HEX >= 0x030B00a4
    if (!exc_state->exc_value) return;
    exc_tb = PyException_GetTraceback(exc_state->exc_value);
    #else
    exc_tb = exc_state->exc_traceback;
    #endif
    if (likely(exc_tb)) {
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
        #if PY_VERSION_HEX >= 0x030B00a4
        Py_DECREF(exc_tb);
        #endif
    }
#endif
}
#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
    ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
static PyObject *
__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
    CYTHON_MAYBE_UNUSED_VAR(gen);
    if (likely(result == PYGEN_RETURN)) {
        int is_async = 0;
        #ifdef __Pyx_AsyncGen_USED
        is_async = __Pyx_AsyncGen_CheckExact(gen);
        #endif
        __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
        Py_XDECREF(retval);
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
#if PY_VERSION_HEX < 0x030d00A1
            _PyGen_SetStopIterationValue(result);
#else
            if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                PyErr_SetObject(PyExc_StopIteration, result);
            } else {
                PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                if (likely(exc != NULL)) {
                    PyErr_SetObject(PyExc_StopIteration, exc);
                    Py_DECREF(exc);
                }
            }
#endif
        }
        Py_DECREF(result);
        result = NULL;
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE __Pyx_PySendResult
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
    __Pyx_PySendResult result;
    PyObject *val = NULL;
    assert(__Pyx_Coroutine_get_is_running(gen));
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
    Py_XDECREF(val);
    return result;
}
#if CYTHON_USE_AM_SEND
static __Pyx_PySendResult
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
    PyObject *ret = NULL;
    __Pyx_PySendResult delegate_result, result;
    assert(__Pyx_Coroutine_get_is_running(gen));
    delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
    if (delegate_result == PYGEN_NEXT) {
        assert (ret != NULL);
        *retval = ret;
        return PYGEN_NEXT;
    }
    assert (delegate_result != PYGEN_ERROR || ret == NULL);
    __Pyx_Coroutine_Undelegate(gen);
    result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
    Py_XDECREF(ret);
    return result;
}
#endif
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
}
static __Pyx_PySendResult
__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
    __Pyx_PySendResult result;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
      #if !CYTHON_USE_AM_SEND
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
      #endif
        {
            #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
            if (value == Py_None && PyIter_Check(yf))
                ret = __Pyx_PyIter_Next_Plain(yf);
            else
            #endif
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
        }
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            *retval = ret;
            return PYGEN_NEXT;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return result;
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    CYTHON_UNUSED_VAR(gen);
    assert(__Pyx_Coroutine_get_is_running(gen));
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        result = __Pyx_Coroutine_Close(yf, &retval);
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
        result = PYGEN_RETURN;
    } else
    #endif
    {
        PyObject *meth;
        result = PYGEN_RETURN;
        meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
        if (unlikely(!meth)) {
            if (unlikely(PyErr_Occurred())) {
                PyErr_WriteUnraisable(yf);
            }
        } else {
            retval = __Pyx_PyObject_CallNoArg(meth);
            Py_DECREF(meth);
            if (unlikely(!retval)) {
                result = PYGEN_ERROR;
            }
        }
    }
    Py_XDECREF(retval);
    return result == PYGEN_ERROR ? -1 : 0;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __Pyx_PySendResult result;
    PyObject *retval = NULL;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    #if CYTHON_USE_AM_SEND
    if (gen->yieldfrom_am_send) {
        result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
    } else
    #endif
    if (gen->yieldfrom) {
        PyObject *yf = gen->yieldfrom;
        PyObject *ret;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
            ret = __Pyx_PyIter_Next_Plain(yf);
        if (likely(ret)) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
    } else {
        result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    }
    __Pyx_Coroutine_unset_is_running(gen);
    return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
    PyObject *retval = NULL;
    __Pyx_PySendResult result;
    CYTHON_UNUSED_VAR(arg);
    result = __Pyx_Coroutine_Close(self, &retval);
    if (unlikely(result == PYGEN_ERROR))
        return NULL;
    Py_XDECREF(retval);
    Py_RETURN_NONE;
}
static __Pyx_PySendResult
__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PySendResult result;
    PyObject *yf;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
        return PYGEN_ERROR;
    }
    yf = gen->yieldfrom;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
    if (result == PYGEN_ERROR) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_Coroutine_unset_is_running(gen);
        if (!__Pyx_PyErr_Occurred()) {
            return PYGEN_RETURN;
        } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
            __Pyx_PyErr_Clear();
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_RETURN;
    } else {
        const char *msg;
        Py_DECREF(*retval);
        *retval = NULL;
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
            msg = "async generator ignored GeneratorExit";
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        __Pyx_Coroutine_unset_is_running(gen);
        return PYGEN_ERROR;
    }
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    yf = gen->yieldfrom;
    if (yf) {
        __Pyx_PySendResult result;
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                goto propagate_exception;
            goto throw_here;
        }
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (unlikely(PyErr_Occurred())) {
                    __Pyx_Coroutine_unset_is_running(gen);
                    return NULL;
                }
                __Pyx_Coroutine_Undelegate(gen);
                goto throw_here;
            }
            if (likely(args)) {
                ret = __Pyx_PyObject_Call(meth, args, NULL);
            } else {
                PyObject *cargs[4] = {NULL, typ, val, tb};
                size_t nargs = 1U + (val != NULL) + (tb != NULL);
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, nargs | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
            }
            Py_DECREF(meth);
        }
        Py_DECREF(yf);
        if (ret) {
            __Pyx_Coroutine_unset_is_running(gen);
            return ret;
        }
        result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
propagate_exception:
    {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
        __Pyx_Coroutine_unset_is_running(gen);
        return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
    }
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
#if PY_VERSION_HEX >= 0x030B00a4
    Py_VISIT(exc_state->exc_value);
#else
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
#endif
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    {
        int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
        if (e) return e;
    }
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    if (gen->gi_weakreflist != NULL)
    #endif
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if CYTHON_USE_TP_FINALIZE
        if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
#else
        {
            destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
            if (del) del(self);
        }
        if (unlikely(Py_REFCNT(self) > 0))
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    __Pyx_PyHeapTypeObject_GC_Del(gen);
}
#if CYTHON_USE_TP_FINALIZE
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *retval = NULL;
        __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
        if (result == PYGEN_ERROR) {
            PyErr_WriteUnraisable(self);
        } else {
            Py_XDECREF(retval);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
}
#endif
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_name;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_name, value);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
{
    PyObject *name = self->gi_qualname;
    CYTHON_UNUSED_VAR(context);
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
    return 0;
}
#if !CYTHON_COMPILING_IN_LIMITED_API
static PyObject *
__Pyx__Coroutine_get_frame_locked(__pyx_CoroutineObject *self) {
    PyObject *frame;
    frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        PyObject *globals = PyDict_New();
        if (unlikely(!globals)) return NULL;
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            globals,                        /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        Py_DECREF(globals);
        if (unlikely(!frame))
            return NULL;
        if (unlikely(self->gi_frame)) {
            Py_DECREF(frame);
            frame = self->gi_frame;
        } else {
            self->gi_frame = frame;
        }
    }
    Py_INCREF(frame);
    return frame;
}
#endif
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)self);
    frame = __Pyx__Coroutine_get_frame_locked(self);
    __Pyx_END_CRITICAL_SECTION();
    return frame;
#else
    CYTHON_UNUSED_VAR(self);
    Py_RETURN_NONE;
#endif
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
    CYTHON_UNUSED_VAR(context);
    PyObject *frame = self->gi_frame;
    if (frame)
        return __Pyx_NewRef(frame);
    return __Pyx__Coroutine_get_frame(self);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->yieldfrom_am_send = NULL;
    #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_exc_state.exc_value = NULL;
    #else
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
    #endif
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    gen->gi_weakreflist = NULL;
#endif
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    result = gen->is_running;
    gen->is_running = 1;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    assert(gen->is_running);
    gen->is_running = 0;
    __Pyx_END_CRITICAL_SECTION();
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    __Pyx_BEGIN_CRITICAL_SECTION((PyObject*)gen);
    result = gen->is_running;
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
    CYTHON_UNUSED_VAR(closure);
    char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
    if (result) Py_RETURN_TRUE;
    else Py_RETURN_FALSE;
}
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
    Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
    if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
        return;
    }
    memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
    static_amsend_methods->am_send = am_send;
    type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
}
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
    CYTHON_UNUSED_VAR(arg);
    __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
    PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                         self_type_name);
    __Pyx_DECREF_TypeName(self_type_name);
    return NULL;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
    {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     PyDoc_STR("object being iterated by 'yield from', or None")},
    {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
#endif
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     PyDoc_STR("name of the generator"), 0},
    {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     PyDoc_STR("qualified name of the generator"), 0},
    {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     PyDoc_STR("Frame of the generator"), 0},
    {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
    {0, 0, 0, 0, 0}
};
static PyType_Slot __pyx_GeneratorType_slots[] = {
    {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
    {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
    {Py_tp_iter, (void *)PyObject_SelfIter},
    {Py_tp_iternext, (void *)__Pyx_Generator_Next},
    {Py_tp_methods, (void *)__pyx_Generator_methods},
    {Py_tp_members, (void *)__pyx_Generator_memberlist},
    {Py_tp_getset, (void *)__pyx_Generator_getsets},
    {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
#if CYTHON_USE_TP_FINALIZE
    {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
#endif
    {0, 0},
};
static PyType_Spec __pyx_GeneratorType_spec = {
    __PYX_TYPE_MODULE_PREFIX "generator",
    sizeof(__pyx_CoroutineObject),
    0,
#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_TPFLAGS_MANAGED_WEAKREF |
#endif
    Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
    __pyx_GeneratorType_slots
};
#if __PYX_HAS_PY_AM_SEND == 2
static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
#endif
static int __pyx_Generator_init(PyObject *module) {
    __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
    mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
        mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
    if (unlikely(!mstate->__pyx_GeneratorType)) {
        return -1;
    }
#if __PYX_HAS_PY_AM_SEND == 2
    __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
#endif
    return 0;
}
static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *retval = NULL;
    if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    }
    __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
    __Pyx_Coroutine_unset_is_running(gen);
    (void) result;
    assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
    assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
    return retval;
}

/* CheckBinaryVersion */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
    const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
    if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
        return 0;
    if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
        return 1;
    {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compile time Python version %d.%d "
                      "of module '%.100s' "
                      "%s "
                      "runtime version %d.%d",
                       (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                       __Pyx_MODULE_NAME,
                       (allow_newer) ? "was newer than" : "does not match",
                       (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
       );
        return PyErr_WarnEx(NULL, message, 1);
    }
}

/* NewCodeObj */
#if CYTHON_COMPILING_IN_LIMITED_API
    static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                       PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                       PyObject *fv, PyObject *cell, PyObject* fn,
                                       PyObject *name, int fline, PyObject *lnos) {
        PyObject *exception_table = NULL;
        PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
        #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
        PyObject *version_info;
        PyObject *py_minor_version = NULL;
        #endif
        long minor_version = 0;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
        minor_version = 11;
        #else
        if (!(version_info = PySys_GetObject("version_info"))) goto end;
        if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
        minor_version = PyLong_AsLong(py_minor_version);
        Py_DECREF(py_minor_version);
        if (minor_version == -1 && PyErr_Occurred()) goto end;
        #endif
        if (!(types_module = PyImport_ImportModule("types"))) goto end;
        if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
        if (minor_version <= 7) {
            (void)p;
            result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else if (minor_version <= 10) {
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, fline, lnos, fv, cell);
        } else {
            if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
            result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                          c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
        }
    end:
        Py_XDECREF(code_type);
        Py_XDECREF(exception_table);
        Py_XDECREF(types_module);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return result;
    }
#elif PY_VERSION_HEX >= 0x030B0000
  static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
    PyCodeObject *result;
    result =
      #if PY_VERSION_HEX >= 0x030C0000
        PyUnstable_Code_NewWithPosOnlyArgs
      #else
        PyCode_NewWithPosOnlyArgs
      #endif
        (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
    if (likely(result))
        result->_co_firsttraceable = 0;
    #endif
    return result;
  }
#elif !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
    Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
    PyObject *varnames_tuple = PyTuple_New(var_count);
    if (unlikely(!varnames_tuple)) return NULL;
    for (Py_ssize_t i=0; i < var_count; i++) {
        Py_INCREF(varnames[i]);
        if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
    }
    #if CYTHON_COMPILING_IN_LIMITED_API
    varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
    if (!varnames_tuple_dedup) {
        if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
        varnames_tuple_dedup = varnames_tuple;
    }
    #else
    varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
    if (unlikely(!varnames_tuple_dedup)) goto done;
    #endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(varnames_tuple_dedup);
    #endif
    if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
        Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(line_table_length == -1)) goto done;
        #endif
        Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
        code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
        if (unlikely(!code_bytes)) goto done;
        char* c_code_bytes = PyBytes_AsString(code_bytes);
        if (unlikely(!c_code_bytes)) goto done;
        memset(c_code_bytes, 0, (size_t) code_len);
    }
    code_obj = (PyObject*) __Pyx__PyCode_New(
        (int) descr.argcount,
        (int) descr.num_posonly_args,
        (int) descr.num_kwonly_args,
        (int) descr.nlocals,
        0,
        (int) descr.flags,
        code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        varnames_tuple_dedup,
        __pyx_mstate_global->__pyx_empty_tuple,
        __pyx_mstate_global->__pyx_empty_tuple,
        filename,
        funcname,
        (int) descr.first_line,
        (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* DecompressString */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
    PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
    const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
    PyObject *methodname = PyUnicode_FromString("decompress");
    if (unlikely(!methodname)) return NULL;
    #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
    if (algo == 3) {
        PyObject *fromlist = Py_BuildValue("[O]", methodname);
        if (unlikely(!fromlist)) goto bad;
        module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
        Py_DECREF(fromlist);
    } else
    #endif
        module = PyImport_ImportModule(module_name);
    if (unlikely(!module)) goto import_failed;
    decompress = PyObject_GetAttr(module, methodname);
    if (unlikely(!decompress)) goto import_failed;
    {
        #ifdef __cplusplus
            char *memview_bytes = const_cast<char*>(s);
        #else
            #if defined(__clang__)
              #pragma clang diagnostic push
              #pragma clang diagnostic ignored "-Wcast-qual"
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic push
              #pragma GCC diagnostic ignored "-Wcast-qual"
            #endif
            char *memview_bytes = (char*) s;
            #if defined(__clang__)
              #pragma clang diagnostic pop
            #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
              #pragma GCC diagnostic pop
            #endif
        #endif
        #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
        int memview_flags = 0x100;
        #else
        int memview_flags = PyBUF_READ;
        #endif
        compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
    }
    if (unlikely(!compressed_bytes)) {
        Py_DECREF(decompress);
        goto bad;
    }
    decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
    Py_DECREF(compressed_bytes);
    Py_DECREF(decompress);
    Py_DECREF(module);
    Py_DECREF(methodname);
    return decompressed;
import_failed:
    PyErr_Format(PyExc_ImportError,
        "Failed to import '%.20s.decompress' - cannot initialise module strings. "
        "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
        module_name, algo);
bad:
    Py_XDECREF(module);
    Py_DECREF(methodname);
    return NULL;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
}
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  else if (!PyErr_Occurred()) {
      PyErr_SetString(PyExc_TypeError,
                      "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


/* MultiPhaseInitModuleState */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
#else
  #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
#endif
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
#error "Module state with PEP489 requires atomics. Currently that's one of\
 C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
#endif
#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
#define __Pyx_ModuleStateLookup_Lock()
#define __Pyx_ModuleStateLookup_Unlock()
#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(__cplusplus) && __cplusplus >= 201103L
#include <mutex>
static std::mutex __Pyx_ModuleStateLookup_mutex;
#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
#include <threads.h>
static mtx_t __Pyx_ModuleStateLookup_mutex;
static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
    mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
}
#define __Pyx_ModuleStateLookup_Lock()\
  call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  mtx_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(HAVE_PTHREAD_H)
#include <pthread.h>
static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
#elif defined(_WIN32)
#include <Windows.h>  // synchapi.h on its own doesn't work
static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
#else
#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
 Requires C standard >= C11, or C++ standard >= C++11,\
 or pthreads, or the Windows 32 API, or Python >= 3.13."
#endif
typedef struct {
    int64_t id;
    PyObject *module;
} __Pyx_InterpreterIdAndModule;
typedef struct {
    char interpreter_id_as_index;
    Py_ssize_t count;
    Py_ssize_t allocated;
    __Pyx_InterpreterIdAndModule table[1];
} __Pyx_ModuleStateLookupData;
#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
#endif
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
#else
static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
#endif
static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
        __Pyx_InterpreterIdAndModule* table,
        Py_ssize_t count,
        int64_t interpreterId) {
    __Pyx_InterpreterIdAndModule* begin = table;
    __Pyx_InterpreterIdAndModule* end = begin + count;
    if (begin->id == interpreterId) {
        return begin;
    }
    while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
        __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
        if (halfway->id == interpreterId) {
            return halfway;
        }
        if (halfway->id < interpreterId) {
            begin = halfway;
        } else {
            end = halfway;
        }
    }
    for (; begin < end; ++begin) {
        if (begin->id >= interpreterId) return begin;
    }
    return begin;
}
static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return NULL;
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
    {
        __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        if (likely(data)) {
            __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
            if (likely(data == new_data)) {
                goto read_finished;
            }
        }
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
        __Pyx_ModuleStateLookup_Lock();
        __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
        data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
        __Pyx_ModuleStateLookup_Unlock();
    }
  read_finished:;
#else
    __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_InterpreterIdAndModule* found = NULL;
    if (unlikely(!data)) goto end;
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            found = data->table+interpreter_id;
        }
    } else {
        found = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
    }
  end:
    {
        PyObject *result=NULL;
        if (found && found->id == interpreter_id) {
            result = found->module;
        }
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
        __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
#endif
        return result;
    }
}
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
    while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
}
#else
#define __Pyx_ModuleStateLookup_wait_until_no_readers()
#endif
static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
    Py_ssize_t to_allocate = (*old_data)->allocated;
    while (to_allocate <= interpreter_id) {
        if (to_allocate == 0) to_allocate = 1;
        else to_allocate *= 2;
    }
    __Pyx_ModuleStateLookupData *new_data = *old_data;
    if (to_allocate != (*old_data)->allocated) {
         new_data = (__Pyx_ModuleStateLookupData *)realloc(
            *old_data,
            sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
        if (!new_data) {
            PyErr_NoMemory();
            return -1;
        }
        for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
            new_data->table[i].id = i;
            new_data->table[i].module = NULL;
        }
        new_data->allocated = to_allocate;
    }
    new_data->table[interpreter_id].module = module;
    if (new_data->count < interpreter_id+1) {
        new_data->count = interpreter_id+1;
    }
    *old_data = new_data;
    return 0;
}
static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
    __Pyx_InterpreterIdAndModule *read = data->table;
    __Pyx_InterpreterIdAndModule *write = data->table;
    __Pyx_InterpreterIdAndModule *end = read + data->count;
    for (; read<end; ++read) {
        if (read->module) {
            write->id = read->id;
            write->module = read->module;
            ++write;
        }
    }
    data->count = write - data->table;
    for (; write<end; ++write) {
        write->id = 0;
        write->module = NULL;
    }
    data->interpreter_id_as_index = 0;
}
static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    int result = 0;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
#endif
    __Pyx_ModuleStateLookupData *new_data = old_data;
    if (!new_data) {
        new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
        if (!new_data) {
            result = -1;
            PyErr_NoMemory();
            goto end;
        }
        new_data->allocated = 1;
        new_data->interpreter_id_as_index = 1;
    }
    __Pyx_ModuleStateLookup_wait_until_no_readers();
    if (new_data->interpreter_id_as_index) {
        if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
            result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
            goto end;
        }
        __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
    }
    {
        Py_ssize_t insert_at = 0;
        {
            __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                new_data->table, new_data->count, interpreter_id);
            assert(lower_bound);
            insert_at = lower_bound - new_data->table;
            if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                lower_bound->module = module;
                goto end;  // already in table, nothing more to do
            }
        }
        if (new_data->count+1 >= new_data->allocated) {
            Py_ssize_t to_allocate = (new_data->count+1)*2;
            new_data =
                (__Pyx_ModuleStateLookupData*)realloc(
                    new_data,
                    sizeof(__Pyx_ModuleStateLookupData) +
                    (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
            if (!new_data) {
                result = -1;
                new_data = old_data;
                PyErr_NoMemory();
                goto end;
            }
            new_data->allocated = to_allocate;
        }
        ++new_data->count;
        int64_t last_id = interpreter_id;
        PyObject *last_module = module;
        for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
            int64_t current_id = new_data->table[i].id;
            new_data->table[i].id = last_id;
            last_id = current_id;
            PyObject *current_module = new_data->table[i].module;
            new_data->table[i].module = last_module;
            last_module = current_module;
        }
    }
  end:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
#else
    __Pyx_ModuleStateLookup_data = new_data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return result;
}
static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
    int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
    if (interpreter_id == -1) return -1;
    __Pyx_ModuleStateLookup_Lock();
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
            __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
#else
    __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
#endif
    if (data->interpreter_id_as_index) {
        if (interpreter_id < data->count) {
            data->table[interpreter_id].module = NULL;
        }
        goto done;
    }
    {
        __Pyx_ModuleStateLookup_wait_until_no_readers();
        __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
            data->table, data->count, interpreter_id);
        if (!lower_bound) goto done;
        if (lower_bound->id != interpreter_id) goto done;
        __Pyx_InterpreterIdAndModule *end = data->table+data->count;
        for (;lower_bound<end-1; ++lower_bound) {
            lower_bound->id = (lower_bound+1)->id;
            lower_bound->module = (lower_bound+1)->module;
        }
    }
    --data->count;
    if (data->count == 0) {
        free(data);
        data = NULL;
    }
  done:
#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
    __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
#else
    __Pyx_ModuleStateLookup_data = data;
#endif
    __Pyx_ModuleStateLookup_Unlock();
    return 0;
}
#endif

/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
