/* Generated by Cython 0.28.3 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "define_macros": [
            [
                "_FORCE_INLINES",
                "1"
            ]
        ],
        "depends": [
            "cupy/cuda/cupy_cudnn.h"
        ],
        "extra_compile_args": [
            "-fopenmp"
        ],
        "extra_link_args": [
            "-Wl,--disable-new-dtags,-rpath,/usr/local/cuda/lib64"
        ],
        "include_dirs": [
            "cupy/cuda",
            "/usr/local/cuda/include"
        ],
        "language": "c++",
        "libraries": [
            "cudnn"
        ],
        "library_dirs": [
            "/usr/local/cuda/lib64"
        ],
        "name": "cupy.cuda.cudnn",
        "sources": [
            "cupy/cuda/cudnn.pyx"
        ]
    },
    "module_name": "cupy.cuda.cudnn"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_28_3"
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !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 HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #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_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #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_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #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
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#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(__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_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #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 __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 ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, 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)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, 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)
  #define __Pyx_DefaultClassType PyType_Type
#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
#if PY_VERSION_HEX <= 0x030700A3 || !defined(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
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#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_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #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_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0; // PyThread_create_key reports success always
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif // TSS (Thread Specific Storage) API
#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
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #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)         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, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#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 && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
  #define PyObject_Unicode             PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__cupy__cuda__cudnn
#define __PYX_HAVE_API__cupy__cuda__cudnn
/* Early includes */
#include <stdint.h>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <vector>
#include "cupy_cudnn.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 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)))  )
#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 const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#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 PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#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_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __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_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(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_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#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__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "cupy/cuda/cudnn.pyx",
  "stringsource",
  "cupy/cuda/cudnn.pxd",
};
/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif


/*--- Type declarations ---*/
struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf;
struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__;
struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr;

/* "driver.pxd":39
 * 
 * 
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     CU_JIT_INPUT_CUBIN = 0
 *     CU_JIT_INPUT_PTX = 1
 */
enum  {
  __pyx_e_4cupy_4cuda_6driver_CU_JIT_INPUT_CUBIN = 0,
  __pyx_e_4cupy_4cuda_6driver_CU_JIT_INPUT_PTX = 1,
  __pyx_e_4cupy_4cuda_6driver_CU_JIT_INPUT_FATBINARY = 2,
  __pyx_e_4cupy_4cuda_6driver_CU_JIT_INPUT_OBJECT = 3,
  __pyx_e_4cupy_4cuda_6driver_CU_JIT_INPUT_LIBRARY = 4,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8,
  __pyx_e_4cupy_4cuda_6driver_CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9,
  __pyx_e_4cupy_4cuda_6driver_CUDA_ERROR_INVALID_VALUE = 1,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_SIGNED_INT8 = 0x08,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_SIGNED_INT16 = 0x09,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_HALF = 0x10,
  __pyx_e_4cupy_4cuda_6driver_CU_AD_FORMAT_FLOAT = 0x20,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_ADDRESS_MODE_WRAP = 0,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_ADDRESS_MODE_CLAMP = 1,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_ADDRESS_MODE_MIRROR = 2,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_ADDRESS_MODE_BORDER = 3,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_FILTER_MODE_POINT = 0,
  __pyx_e_4cupy_4cuda_6driver_CU_TR_FILTER_MODE_LINEAR = 1,
  __pyx_e_4cupy_4cuda_6driver_CU_TRSA_OVERRIDE_FORMAT = 0x01,
  __pyx_e_4cupy_4cuda_6driver_CU_TRSF_READ_AS_INTEGER = 0x01,
  __pyx_e_4cupy_4cuda_6driver_CU_TRSF_NORMALIZED_COORDINATES = 0x02,
  __pyx_e_4cupy_4cuda_6driver_CU_TRSF_SRGB = 0x10
};

/* "cupy/cuda/cudnn.pxd":8
 * ###############################################################################
 * 
 * cpdef enum:             # <<<<<<<<<<<<<<
 *     CUDNN_DATA_FLOAT = 0
 *     CUDNN_DATA_DOUBLE = 1
 */
enum  {
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_FLOAT = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_DOUBLE = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_HALF = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DEFAULT_MATH = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_OP_MATH = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_NOT_PROPAGATE_NAN = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PROPAGATE_NAN = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_NON_DETERMINISTIC = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DETERMINISTIC = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_NCHW = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_NHWC = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_ADD = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MUL = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MIN = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MAX = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_SQRT = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_NOT = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_ADD = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MUL = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MIN = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MAX = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_AMAX = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_AVG = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NORM1 = 6,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NORM2 = 7,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS = 8,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NO_INDICES = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_FLATTENED_INDICES = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_32BIT_INDICES = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_64BIT_INDICES = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_16BIT_INDICES = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_8BIT_INDICES = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_IMAGE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_HW = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_FEATURE_MAP = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_CHW = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_C = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_FULL_TENSOR = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CROSS_CORRELATION = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_NO_WORKSPACE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_PREFER_FASTEST = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_GEMM = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_DIRECT = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_FFT = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD = 6,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED = 7,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0 = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1 = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_0 = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_1 = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_FAST = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_ACCURATE = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_LOG = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_MODE_INSTANCE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_MODE_CHANNEL = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_MAX = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_MAX_DETERMINISTIC = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_SIGMOID = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_RELU = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_TANH = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_CLIPPED_RELU = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_ELU = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_IDENTITY = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_LRN_CROSS_CHANNEL_DIM1 = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_DIVNORM_PRECOMPUTED_MEANS = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_PER_ACTIVATION = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_SPATIAL = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_SPATIAL_PERSISTENT = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CTC_LOSS_ALGO_DETERMINISTIC = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN_ACTIVATION = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_RELU = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_TANH = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_LSTM = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_GRU = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_UNIDIRECTIONAL = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_BIDIRECTIONAL = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_STANDARD = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_PERSIST_STATIC = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_PERSIST_DYNAMIC = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_PADDED_IO_DISABLED = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_PADDED_IO_ENABLED = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_LINEAR_INPUT = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SKIP_INPUT = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SAMPLER_BILINEAR = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_SUCCESS = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING = 11,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_IN_PROGRESS = 12,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_FP_OVERFLOW = 13,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_RAWCODE = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_NONBLOCKING = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_BLOCKING = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM = 6,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_XDESC = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_XDATA_PLACEHOLDER = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_MODE = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQSCALEBIAS_DESC = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_DESC = 6,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_CONV_DESC = 7,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_WDESC = 8,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_WDATA_PLACEHOLDER = 9,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DWDESC = 10,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DWDATA_PLACEHOLDER = 11,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YDESC = 12,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YDATA_PLACEHOLDER = 13,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DYDESC = 14,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DYDATA_PLACEHOLDER = 15,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSTATS_DESC = 16,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSUM_PLACEHOLDER = 17,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSQSUM_PLACEHOLDER = 18,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC = 19,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SCALE_PLACEHOLDER = 20,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_BIAS_PLACEHOLDER = 21,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER = 22,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER = 23,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER = 24,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER = 25,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ZDESC = 26,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ZDATA_PLACEHOLDER = 27,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC = 28,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER = 29,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER = 30,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_BITMASK_DESC = 31,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER = 32,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DXDESC = 33,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DXDATA_PLACEHOLDER = 34,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DZDESC = 35,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DZDATA_PLACEHOLDER = 36,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_DSCALE_PLACEHOLDER = 37,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_DBIAS_PLACEHOLDER = 38,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_NULL = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ELEM_ALIGNED = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_16B_ALIGNED = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_XDATA = 0,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_EQSCALE = 1,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_EQBIAS = 2,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_WDATA = 3,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DWDATA = 4,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YDATA = 5,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DYDATA = 6,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YSUM = 7,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YSQSUM = 8,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_WORKSPACE = 9,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SCALE = 10,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_BIAS = 11,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SAVED_MEAN = 12,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SAVED_INVSTD = 13,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_RUNNING_MEAN = 14,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_RUNNING_VAR = 15,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ZDATA = 16,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_Z_EQSCALE = 17,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_Z_EQBIAS = 18,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ACTIVATION_BITMASK = 19,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DXDATA = 20,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DZDATA = 21,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_DSCALE = 22,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_DBIAS = 23,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES = 0x64,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT = 0x65,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR = 0x66,
  __pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_DOUBLE_BN_EPSILON = 0x67
};

/* "cupy/cuda/cudnn.pxd":252
 * ###############################################################################
 * 
 * cdef class CuDNNAlgoPerf:             # <<<<<<<<<<<<<<
 *     cdef:
 *         int algo
 */
struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf {
  PyObject_HEAD
  int algo;
  int status;
  float time;
  size_t memory;
  int determinism;
  int mathType;
};


/* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */
struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* "cupy/cuda/cudnn.pyx":776
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 *             '\n  ' + info for info in self._infos)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *__pyx_outer_scope;
  PyObject *__pyx_v_info;
};


/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, 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;
#ifdef WITH_THREAD
  #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__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #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) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #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_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)

/* PyObjectGetAttrStr.proto */
#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

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

/* 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);

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

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* PyErrExceptionMatches.proto */
#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 */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#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
#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

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

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

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyObjectCall.proto */
#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

/* IncludeStringH.proto */
#include <string.h>

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

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

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

/* 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);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg);

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

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* 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);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

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

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

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

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (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)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (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);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (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);
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);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

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

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnStatus_t(cudnnStatus_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnDataType_t(cudnnDataType_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnOpTensorOp_t(cudnnOpTensorOp_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnNanPropagation_t(cudnnNanPropagation_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnReduceTensorOp_t(cudnnReduceTensorOp_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnReduceTensorIndices_t(cudnnReduceTensorIndices_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnIndicesType_t(cudnnIndicesType_t value);

/* 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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnTensorFormat_t(cudnnTensorFormat_t value);

static PyObject* __pyx_convert__to_py_cudnnConvolutionFwdAlgoPerf_t(cudnnConvolutionFwdAlgoPerf_t s);
static PyObject* __pyx_convert__to_py_cudnnConvolutionBwdFilterAlgoPerf_t(cudnnConvolutionBwdFilterAlgoPerf_t s);
static PyObject* __pyx_convert__to_py_cudnnConvolutionBwdDataAlgoPerf_t(cudnnConvolutionBwdDataAlgoPerf_t s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnRNNPaddingMode_t(cudnnRNNPaddingMode_t value);

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *);

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(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_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* 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

/* SwapException.proto */
#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

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    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 int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->exc_type, &(self)->exc_value, &(self)->exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(self);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->exc_type, (self)->exc_value, (self)->exc_traceback);\
    (self)->exc_type = (self)->exc_value = (self)->exc_traceback = NULL;\
    }
#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_CoroutineObject *self);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

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

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

/* ModuleImport.proto */
static PyObject *__Pyx_ImportModule(const char *name);

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

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


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

/* Module declarations from 'cython' */

/* Module declarations from 'libcpp' */

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

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

/* Module declarations from 'cupy.cuda.driver' */

/* Module declarations from 'cupy.cuda.stream' */
static intptr_t (*__pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr)(void); /*proto*/

/* Module declarations from 'cupy.cuda.cudnn' */
static PyTypeObject *__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf = 0;
static PyTypeObject *__pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ = 0;
static PyTypeObject *__pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr = 0;
static size_t __pyx_f_4cupy_4cuda_5cudnn_getVersion(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_queryRuntimeError(intptr_t, int, int __pyx_skip_dispatch); /*proto*/
static intptr_t __pyx_f_4cupy_4cuda_5cudnn_create(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroy(intptr_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setStream(intptr_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getStream(intptr_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createTensorDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptor(size_t, int, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptorEx(size_t, int, int, int, int, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getTensor4dDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensorNdDescriptor(size_t, int, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyTensorDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_addTensor_v3(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createOpTensorDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setOpTensorDescriptor(size_t, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getOpTensorDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyOpTensorDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_opTensor(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createReduceTensorDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setReduceTensorDescriptor(size_t, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getReduceTensorDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyReduceTensorDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getReductionIndicesSize(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getReductionWorkspaceSize(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_reduceTensor(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_scaleTensor(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createFilterDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFilter4dDescriptor_v4(size_t, int, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFilterNdDescriptor_v4(size_t, int, int, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFilterNdDescriptor(size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFilterDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createConvolutionDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionMathType(size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionMathType(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionGroupCount(size_t, int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionGroupCount(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v4(size_t, int, int, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v5(size_t, int, int, int, int, int, int, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionNdDescriptor_v3(size_t, int, size_t, size_t, size_t, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyConvolutionDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithm(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx_v7(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v6(intptr_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v7(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardWorkspaceSize(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionForward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardBias(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithm(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx_v7(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v6(intptr_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v7(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterWorkspaceSize(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardFilter_v3(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithm(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx_v7(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v6(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v7(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataWorkspaceSize(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardData_v3(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createPoolingDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPooling2dDescriptor_v4(size_t, int, int, int, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPoolingNdDescriptor_v4(size_t, int, int, int, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyPoolingDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_poolingForward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_poolingBackward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_deriveBNTensorDescriptor(size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTraining(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, double, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardInference(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackward(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTrainingEx(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, double, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationForwardTrainingExWorkspaceSize(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackwardEx(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationBackwardExWorkspaceSize(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationTrainingExReserveSpaceSize(intptr_t, int, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createActivationDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setActivationDescriptor(size_t, int, int, double, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyActivationDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_softmaxForward(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_softmaxBackward(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_activationForward_v4(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_activationBackward_v4(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createDropoutDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyDropoutDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_dropoutGetStatesSize(intptr_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setDropoutDescriptor(size_t, intptr_t, float, size_t, size_t, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getDropoutReserveSpaceSize(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_dropoutForward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_dropoutBackward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createCTCLossDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyCTCLossDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setCTCLossDescriptor(size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getCTCLossDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getCTCLossWorkspaceSize(intptr_t, size_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_CTCLoss(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createRNNDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createPersistentRNNPlan(size_t, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPersistentRNNPlan(size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyPersistentRNNPlan(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v5(size_t, int, int, size_t, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v6(intptr_t, size_t, int, int, size_t, int, int, int, int, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNPaddingMode(size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNPaddingMode(size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createRNNDataDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDataDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDataDescriptor(size_t, int, size_t, int, int, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNDataDescriptor(size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNWorkspaceSize(intptr_t, size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNTrainingReserveSize(intptr_t, size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNParamsSize(intptr_t, size_t, size_t, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerMatrixParams(intptr_t, size_t, int, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerBiasParams(intptr_t, size_t, int, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInference(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTraining(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardData(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeights(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInferenceEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTrainingEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardDataEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeightsEx(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createSpatialTransformerDescriptor(int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroySpatialTransformerDescriptor(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setSpatialTransformerDescriptor(size_t, size_t, int, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorForward(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorBackward(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerForward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerBackward(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsConstParamPack(int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsConstParamPack(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsConstParamPackAttribute(size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsConstParamPackAttribute(size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsVariantParamPack(int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsVariantParamPack(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsVariantParamPackAttribute(size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsVariantParamPackAttribute(size_t, int, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsPlan(int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsPlan(size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_makeFusedOpsPlan(intptr_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_fusedOpsExecute(intptr_t, size_t, size_t, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_4cuda_5cudnn_check_status(int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn___pyx_unpickle_CuDNNAlgoPerf__set_state(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *, PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t(const std::vector<cudnnConvolutionFwdAlgoPerf_t>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t(const std::vector<cudnnConvolutionBwdFilterAlgoPerf_t>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(const std::vector<cudnnConvolutionBwdDataAlgoPerf_t>  &); /*proto*/
#define __Pyx_MODULE_NAME "cupy.cuda.cudnn"
extern int __pyx_module_is_main_cupy__cuda__cudnn;
int __pyx_module_is_main_cupy__cuda__cudnn = 0;

/* Implementation of 'cupy.cuda.cudnn' */
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_range;
static const char __pyx_k_[] = "\n  ";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_B[] = "B";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_u[] = "u";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_z[] = "z";
static const char __pyx_k__2[] = "";
static const char __pyx_k_cx[] = "cx";
static const char __pyx_k_cy[] = "cy";
static const char __pyx_k_dw[] = "dw";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_dy[] = "dy";
static const char __pyx_k_dz[] = "dz";
static const char __pyx_k_hx[] = "hx";
static const char __pyx_k_hy[] = "hy";
static const char __pyx_k_dcx[] = "dcx";
static const char __pyx_k_dcy[] = "dcy";
static const char __pyx_k_dhx[] = "dhx";
static const char __pyx_k_dhy[] = "dhy";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_ptr[] = "ptr";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_algo[] = "algo";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_dimA[] = "dimA";
static const char __pyx_k_grid[] = "grid";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_padA[] = "padA";
static const char __pyx_k_plan[] = "plan";
static const char __pyx_k_seed[] = "seed";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_aDesc[] = "aDesc";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_bDesc[] = "bDesc";
static const char __pyx_k_bnOps[] = "bnOps";
static const char __pyx_k_bnops[] = "bnops";
static const char __pyx_k_cAttn[] = "cAttn";
static const char __pyx_k_cDesc[] = "cDesc";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_costs[] = "costs";
static const char __pyx_k_dgrid[] = "dgrid";
static const char __pyx_k_dkeys[] = "dkeys";
static const char __pyx_k_iAttn[] = "iAttn";
static const char __pyx_k_iDesc[] = "iDesc";
static const char __pyx_k_infos[] = "_infos";
static const char __pyx_k_kDesc[] = "kDesc";
static const char __pyx_k_layer[] = "layer";
static const char __pyx_k_pad_h[] = "pad_h";
static const char __pyx_k_pad_w[] = "pad_w";
static const char __pyx_k_param[] = "param";
static const char __pyx_k_probs[] = "probs";
static const char __pyx_k_qDesc[] = "qDesc";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_theta[] = "theta";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_wDesc[] = "wDesc";
static const char __pyx_k_xDesc[] = "xDesc";
static const char __pyx_k_yDesc[] = "yDesc";
static const char __pyx_k_zDesc[] = "zDesc";
static const char __pyx_k_alpha1[] = "alpha1";
static const char __pyx_k_alpha2[] = "alpha2";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_bnBias[] = "bnBias";
static const char __pyx_k_cxDesc[] = "cxDesc";
static const char __pyx_k_cyDesc[] = "cyDesc";
static const char __pyx_k_dcAttn[] = "dcAttn";
static const char __pyx_k_dcDesc[] = "dcDesc";
static const char __pyx_k_dkDesc[] = "dkDesc";
static const char __pyx_k_dtheta[] = "dtheta";
static const char __pyx_k_dwDesc[] = "dwDesc";
static const char __pyx_k_dxData[] = "dxData";
static const char __pyx_k_dxDesc[] = "dxDesc";
static const char __pyx_k_dyData[] = "dyData";
static const char __pyx_k_dyDesc[] = "dyDesc";
static const char __pyx_k_dzDesc[] = "dzDesc";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_handle[] = "handle";
static const char __pyx_k_hxDesc[] = "hxDesc";
static const char __pyx_k_hyDesc[] = "hyDesc";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_labels[] = "labels";
static const char __pyx_k_layout[] = "layout";
static const char __pyx_k_memory[] = "memory";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_nbDims[] = "nbDims";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_stDesc[] = "stDesc";
static const char __pyx_k_states[] = "states";
static const char __pyx_k_status[] = "status";
static const char __pyx_k_stream[] = "stream";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_bnScale[] = "bnScale";
static const char __pyx_k_cStride[] = "cStride";
static const char __pyx_k_dcxDesc[] = "dcxDesc";
static const char __pyx_k_dcyDesc[] = "dcyDesc";
static const char __pyx_k_dhxDesc[] = "dhxDesc";
static const char __pyx_k_dhyDesc[] = "dhyDesc";
static const char __pyx_k_dropout[] = "dropout";
static const char __pyx_k_dstData[] = "dstData";
static const char __pyx_k_dstDesc[] = "dstDesc";
static const char __pyx_k_epsilon[] = "epsilon";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_hStride[] = "hStride";
static const char __pyx_k_indices[] = "indices";
static const char __pyx_k_infos_2[] = "infos";
static const char __pyx_k_nStride[] = "nStride";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_queries[] = "queries";
static const char __pyx_k_rnnDesc[] = "rnnDesc";
static const char __pyx_k_srcData[] = "srcData";
static const char __pyx_k_srcDesc[] = "srcDesc";
static const char __pyx_k_strideA[] = "strideA";
static const char __pyx_k_varPack[] = "varPack";
static const char __pyx_k_wStride[] = "wStride";
static const char __pyx_k_add_info[] = "add_info";
static const char __pyx_k_convDesc[] = "convDesc";
static const char __pyx_k_dataType[] = "dataType";
static const char __pyx_k_destData[] = "destData";
static const char __pyx_k_destDesc[] = "destDesc";
static const char __pyx_k_diffData[] = "diffData";
static const char __pyx_k_diffDesc[] = "diffDesc";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_gradData[] = "gradData";
static const char __pyx_k_gradDesc[] = "gradDesc";
static const char __pyx_k_mathType[] = "mathType";
static const char __pyx_k_paddingA[] = "paddingA";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_valuePtr[] = "valuePtr";
static const char __pyx_k_add_infos[] = "add_infos";
static const char __pyx_k_algorithm[] = "algorithm";
static const char __pyx_k_batchSize[] = "batchSize";
static const char __pyx_k_betaDgrid[] = "betaDgrid";
static const char __pyx_k_constPack[] = "constPack";
static const char __pyx_k_dilationA[] = "dilationA";
static const char __pyx_k_direction[] = "direction";
static const char __pyx_k_gradients[] = "gradients";
static const char __pyx_k_inputMode[] = "inputMode";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_minibatch[] = "minibatch";
static const char __pyx_k_numLayers[] = "numLayers";
static const char __pyx_k_probsDesc[] = "probsDesc";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_savedMean[] = "savedMean";
static const char __pyx_k_seqLength[] = "seqLength";
static const char __pyx_k_workSpace[] = "workSpace";
static const char __pyx_k_workspace[] = "workspace";
static const char __pyx_k_CuDNNError[] = "CuDNNError";
static const char __pyx_k_alphaDgrid[] = "alphaDgrid";
static const char __pyx_k_bnBiasData[] = "bnBiasData";
static const char __pyx_k_dilation_h[] = "dilation_h";
static const char __pyx_k_dilation_w[] = "dilation_w";
static const char __pyx_k_filterData[] = "filterData";
static const char __pyx_k_filterDesc[] = "filterDesc";
static const char __pyx_k_filterDimA[] = "filterDimA";
static const char __pyx_k_groupCount[] = "groupCount";
static const char __pyx_k_hiddenSize[] = "hiddenSize";
static const char __pyx_k_linLayerID[] = "linLayerID";
static const char __pyx_k_opTensorOp[] = "opTensorOp";
static const char __pyx_k_paramLabel[] = "paramLabel";
static const char __pyx_k_preference[] = "preference";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_reluNanOpt[] = "reluNanOpt";
static const char __pyx_k_tensorDesc[] = "tensorDesc";
static const char __pyx_k_vectorSize[] = "vectorSize";
static const char __pyx_k_windowDimA[] = "windowDimA";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_RNNDataDesc[] = "RNNDataDesc";
static const char __pyx_k_arrayLength[] = "arrayLength";
static const char __pyx_k_bnScaleData[] = "bnScaleData";
static const char __pyx_k_computeType[] = "computeType";
static const char __pyx_k_ctcLossDesc[] = "ctcLossDesc";
static const char __pyx_k_cuDNN_Error[] = "cuDNN Error: {}";
static const char __pyx_k_dBnBiasData[] = "dBnBiasData";
static const char __pyx_k_determinism[] = "determinism";
static const char __pyx_k_dropoutDesc[] = "dropoutDesc";
static const char __pyx_k_linLayerMat[] = "linLayerMat";
static const char __pyx_k_paddingFill[] = "paddingFill";
static const char __pyx_k_paddingMode[] = "paddingMode";
static const char __pyx_k_poolingDesc[] = "poolingDesc";
static const char __pyx_k_reluCeiling[] = "reluCeiling";
static const char __pyx_k_samplerType[] = "samplerType";
static const char __pyx_k_srcDiffData[] = "srcDiffData";
static const char __pyx_k_srcDiffDesc[] = "srcDiffDesc";
static const char __pyx_k_windowWidth[] = "windowWidth";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_betaDataDiff[] = "betaDataDiff";
static const char __pyx_k_dBnScaleData[] = "dBnScaleData";
static const char __pyx_k_destDiffData[] = "destDiffData";
static const char __pyx_k_destDiffDesc[] = "destDiffDesc";
static const char __pyx_k_inputLengths[] = "inputLengths";
static const char __pyx_k_labelLengths[] = "labelLengths";
static const char __pyx_k_linLayerBias[] = "linLayerBias";
static const char __pyx_k_maxSeqLength[] = "maxSeqLength";
static const char __pyx_k_opTensorDesc[] = "opTensorDesc";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_reserveSpace[] = "reserveSpace";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_windowHeight[] = "windowHeight";
static const char __pyx_k_alphaDataDiff[] = "alphaDataDiff";
static const char __pyx_k_betaParamDiff[] = "betaParamDiff";
static const char __pyx_k_dBnBiasResult[] = "dBnBiasResult";
static const char __pyx_k_derivedBnDesc[] = "derivedBnDesc";
static const char __pyx_k_estimatedMean[] = "estimatedMean";
static const char __pyx_k_filterStrideA[] = "filterStrideA";
static const char __pyx_k_gradientsDesc[] = "gradientsDesc";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_activationDesc[] = "activationDesc";
static const char __pyx_k_alphaParamDiff[] = "alphaParamDiff";
static const char __pyx_k_dBnScaleResult[] = "dBnScaleResult";
static const char __pyx_k_opTensorNanOpt[] = "opTensorNanOpt";
static const char __pyx_k_reduceTensorOp[] = "reduceTensorOp";
static const char __pyx_k_resultSaveMean[] = "resultSaveMean";
static const char __pyx_k_seqLengthArray[] = "seqLengthArray";
static const char __pyx_k_verticalStride[] = "verticalStride";
static const char __pyx_k_cupy_cuda_cudnn[] = "cupy.cuda.cudnn";
static const char __pyx_k_linLayerMatDesc[] = "linLayerMatDesc";
static const char __pyx_k_nbDimsRequested[] = "nbDimsRequested";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_verticalPadding[] = "verticalPadding";
static const char __pyx_k_CuDNNError___str[] = "CuDNNError.__str__";
static const char __pyx_k_dBnScaleBiasDesc[] = "dBnScaleBiasDesc";
static const char __pyx_k_horizontalStride[] = "horizontalStride";
static const char __pyx_k_linLayerBiasDesc[] = "linLayerBiasDesc";
static const char __pyx_k_maxpoolingNanOpt[] = "maxpoolingNanOpt";
static const char __pyx_k_opTensorCompType[] = "opTensorCompType";
static const char __pyx_k_reduceTensorDesc[] = "reduceTensorDesc";
static const char __pyx_k_savedInvVariance[] = "savedInvVariance";
static const char __pyx_k_stateSizeInBytes[] = "stateSizeInBytes";
static const char __pyx_k_CuDNNError___init[] = "CuDNNError.__init__";
static const char __pyx_k_estimatedVariance[] = "estimatedVariance";
static const char __pyx_k_get_build_version[] = "get_build_version";
static const char __pyx_k_horizontalPadding[] = "horizontalPadding";
static const char __pyx_k_resultRunningMean[] = "resultRunningMean";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_indicesSizeInBytes[] = "indicesSizeInBytes";
static const char __pyx_k_memoryLimitInbytes[] = "memoryLimitInbytes";
static const char __pyx_k_reduceTensorNanOpt[] = "reduceTensorNanOpt";
static const char __pyx_k_requestedAlgoCount[] = "requestedAlgoCount";
static const char __pyx_k_CuDNNError___reduce[] = "CuDNNError.__reduce__";
static const char __pyx_k_CuDNNError_add_info[] = "CuDNNError.add_info";
static const char __pyx_k_cupy_cuda_cudnn_pyx[] = "cupy/cuda/cudnn.pyx";
static const char __pyx_k_reduceTensorIndices[] = "reduceTensorIndices";
static const char __pyx_k_CUDNN_BN_MIN_EPSILON[] = "CUDNN_BN_MIN_EPSILON";
static const char __pyx_k_CuDNNError_add_infos[] = "CuDNNError.add_infos";
static const char __pyx_k_arrayLengthRequested[] = "arrayLengthRequested";
static const char __pyx_k_reduceTensorCompType[] = "reduceTensorCompType";
static const char __pyx_k_workSpaceSizeInBytes[] = "workSpaceSizeInBytes";
static const char __pyx_k_workspaceSizeInBytes[] = "workspaceSizeInBytes";
static const char __pyx_k_Thin_wrapper_of_cuDNN[] = "Thin wrapper of cuDNN.";
static const char __pyx_k_resultRunningVariance[] = "resultRunningVariance";
static const char __pyx_k_resultSaveInvVariance[] = "resultSaveInvVariance";
static const char __pyx_k_bnScaleBiasMeanVarDesc[] = "bnScaleBiasMeanVarDesc";
static const char __pyx_k_reduceTensorIndicesType[] = "reduceTensorIndicesType";
static const char __pyx_k_reserveSpaceSizeInBytes[] = "reserveSpaceSizeInBytes";
static const char __pyx_k_exponentialAverageFactor[] = "exponentialAverageFactor";
static const char __pyx_k_pyx_unpickle_CuDNNAlgoPerf[] = "__pyx_unpickle_CuDNNAlgoPerf";
static const char __pyx_k_CuDNNError___str___locals_genexp[] = "CuDNNError.__str__.<locals>.genexpr";
static const char __pyx_k_Incompatible_checksums_s_vs_0x8e[] = "Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))";
static PyObject *__pyx_kp_u_;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_B;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_CUDNN_BN_MIN_EPSILON;
static PyObject *__pyx_n_s_CuDNNError;
static PyObject *__pyx_n_s_CuDNNError___init;
static PyObject *__pyx_n_s_CuDNNError___reduce;
static PyObject *__pyx_n_s_CuDNNError___str;
static PyObject *__pyx_n_s_CuDNNError___str___locals_genexp;
static PyObject *__pyx_n_s_CuDNNError_add_info;
static PyObject *__pyx_n_s_CuDNNError_add_infos;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x8e;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_RNNDataDesc;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_kp_u__2;
static PyObject *__pyx_n_s_aDesc;
static PyObject *__pyx_n_s_activationDesc;
static PyObject *__pyx_n_s_add_info;
static PyObject *__pyx_n_s_add_infos;
static PyObject *__pyx_n_s_algo;
static PyObject *__pyx_n_s_algorithm;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_alpha1;
static PyObject *__pyx_n_s_alpha2;
static PyObject *__pyx_n_s_alphaDataDiff;
static PyObject *__pyx_n_s_alphaDgrid;
static PyObject *__pyx_n_s_alphaParamDiff;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_arrayLength;
static PyObject *__pyx_n_s_arrayLengthRequested;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_bDesc;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_batchSize;
static PyObject *__pyx_n_s_beta;
static PyObject *__pyx_n_s_betaDataDiff;
static PyObject *__pyx_n_s_betaDgrid;
static PyObject *__pyx_n_s_betaParamDiff;
static PyObject *__pyx_n_s_bnBias;
static PyObject *__pyx_n_s_bnBiasData;
static PyObject *__pyx_n_s_bnOps;
static PyObject *__pyx_n_s_bnScale;
static PyObject *__pyx_n_s_bnScaleBiasMeanVarDesc;
static PyObject *__pyx_n_s_bnScaleData;
static PyObject *__pyx_n_s_bnops;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_cAttn;
static PyObject *__pyx_n_s_cDesc;
static PyObject *__pyx_n_s_cStride;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_computeType;
static PyObject *__pyx_n_s_constPack;
static PyObject *__pyx_n_s_convDesc;
static PyObject *__pyx_n_s_costs;
static PyObject *__pyx_n_s_ctcLossDesc;
static PyObject *__pyx_kp_u_cuDNN_Error;
static PyObject *__pyx_n_s_cupy_cuda_cudnn;
static PyObject *__pyx_kp_s_cupy_cuda_cudnn_pyx;
static PyObject *__pyx_n_s_cx;
static PyObject *__pyx_n_s_cxDesc;
static PyObject *__pyx_n_s_cy;
static PyObject *__pyx_n_s_cyDesc;
static PyObject *__pyx_n_s_dBnBiasData;
static PyObject *__pyx_n_s_dBnBiasResult;
static PyObject *__pyx_n_s_dBnScaleBiasDesc;
static PyObject *__pyx_n_s_dBnScaleData;
static PyObject *__pyx_n_s_dBnScaleResult;
static PyObject *__pyx_n_s_dataType;
static PyObject *__pyx_n_s_dcAttn;
static PyObject *__pyx_n_s_dcDesc;
static PyObject *__pyx_n_s_dcx;
static PyObject *__pyx_n_s_dcxDesc;
static PyObject *__pyx_n_s_dcy;
static PyObject *__pyx_n_s_dcyDesc;
static PyObject *__pyx_n_s_derivedBnDesc;
static PyObject *__pyx_n_s_destData;
static PyObject *__pyx_n_s_destDesc;
static PyObject *__pyx_n_s_destDiffData;
static PyObject *__pyx_n_s_destDiffDesc;
static PyObject *__pyx_n_s_determinism;
static PyObject *__pyx_n_s_dgrid;
static PyObject *__pyx_n_s_dhx;
static PyObject *__pyx_n_s_dhxDesc;
static PyObject *__pyx_n_s_dhy;
static PyObject *__pyx_n_s_dhyDesc;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_diffData;
static PyObject *__pyx_n_s_diffDesc;
static PyObject *__pyx_n_s_dilationA;
static PyObject *__pyx_n_s_dilation_h;
static PyObject *__pyx_n_s_dilation_w;
static PyObject *__pyx_n_s_dimA;
static PyObject *__pyx_n_s_direction;
static PyObject *__pyx_n_s_dkDesc;
static PyObject *__pyx_n_s_dkeys;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dropout;
static PyObject *__pyx_n_s_dropoutDesc;
static PyObject *__pyx_n_s_dstData;
static PyObject *__pyx_n_s_dstDesc;
static PyObject *__pyx_n_s_dtheta;
static PyObject *__pyx_n_s_dw;
static PyObject *__pyx_n_s_dwDesc;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_dxData;
static PyObject *__pyx_n_s_dxDesc;
static PyObject *__pyx_n_s_dy;
static PyObject *__pyx_n_s_dyData;
static PyObject *__pyx_n_s_dyDesc;
static PyObject *__pyx_n_s_dz;
static PyObject *__pyx_n_s_dzDesc;
static PyObject *__pyx_n_s_epsilon;
static PyObject *__pyx_n_s_estimatedMean;
static PyObject *__pyx_n_s_estimatedVariance;
static PyObject *__pyx_n_s_exponentialAverageFactor;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_n_s_filterData;
static PyObject *__pyx_n_s_filterDesc;
static PyObject *__pyx_n_s_filterDimA;
static PyObject *__pyx_n_s_filterStrideA;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get_build_version;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_gradData;
static PyObject *__pyx_n_s_gradDesc;
static PyObject *__pyx_n_s_gradients;
static PyObject *__pyx_n_s_gradientsDesc;
static PyObject *__pyx_n_s_grid;
static PyObject *__pyx_n_s_groupCount;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_hStride;
static PyObject *__pyx_n_s_handle;
static PyObject *__pyx_n_s_hiddenSize;
static PyObject *__pyx_n_s_horizontalPadding;
static PyObject *__pyx_n_s_horizontalStride;
static PyObject *__pyx_n_s_hx;
static PyObject *__pyx_n_s_hxDesc;
static PyObject *__pyx_n_s_hy;
static PyObject *__pyx_n_s_hyDesc;
static PyObject *__pyx_n_s_iAttn;
static PyObject *__pyx_n_s_iDesc;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_indicesSizeInBytes;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_infos;
static PyObject *__pyx_n_s_infos_2;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_inputLengths;
static PyObject *__pyx_n_s_inputMode;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_kDesc;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_labelLengths;
static PyObject *__pyx_n_s_labels;
static PyObject *__pyx_n_s_layer;
static PyObject *__pyx_n_s_layout;
static PyObject *__pyx_n_s_linLayerBias;
static PyObject *__pyx_n_s_linLayerBiasDesc;
static PyObject *__pyx_n_s_linLayerID;
static PyObject *__pyx_n_s_linLayerMat;
static PyObject *__pyx_n_s_linLayerMatDesc;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_mathType;
static PyObject *__pyx_n_s_maxSeqLength;
static PyObject *__pyx_n_s_maxpoolingNanOpt;
static PyObject *__pyx_n_s_memory;
static PyObject *__pyx_n_s_memoryLimitInbytes;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_minibatch;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_nStride;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nbDims;
static PyObject *__pyx_n_s_nbDimsRequested;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_numLayers;
static PyObject *__pyx_n_s_opTensorCompType;
static PyObject *__pyx_n_s_opTensorDesc;
static PyObject *__pyx_n_s_opTensorNanOpt;
static PyObject *__pyx_n_s_opTensorOp;
static PyObject *__pyx_n_s_padA;
static PyObject *__pyx_n_s_pad_h;
static PyObject *__pyx_n_s_pad_w;
static PyObject *__pyx_n_s_paddingA;
static PyObject *__pyx_n_s_paddingFill;
static PyObject *__pyx_n_s_paddingMode;
static PyObject *__pyx_n_s_param;
static PyObject *__pyx_n_s_paramLabel;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_plan;
static PyObject *__pyx_n_s_poolingDesc;
static PyObject *__pyx_n_s_preference;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_probs;
static PyObject *__pyx_n_s_probsDesc;
static PyObject *__pyx_n_s_ptr;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_CuDNNAlgoPerf;
static PyObject *__pyx_n_s_qDesc;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_queries;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduceTensorCompType;
static PyObject *__pyx_n_s_reduceTensorDesc;
static PyObject *__pyx_n_s_reduceTensorIndices;
static PyObject *__pyx_n_s_reduceTensorIndicesType;
static PyObject *__pyx_n_s_reduceTensorNanOpt;
static PyObject *__pyx_n_s_reduceTensorOp;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reluCeiling;
static PyObject *__pyx_n_s_reluNanOpt;
static PyObject *__pyx_n_s_requestedAlgoCount;
static PyObject *__pyx_n_s_reserveSpace;
static PyObject *__pyx_n_s_reserveSpaceSizeInBytes;
static PyObject *__pyx_n_s_resultRunningMean;
static PyObject *__pyx_n_s_resultRunningVariance;
static PyObject *__pyx_n_s_resultSaveInvVariance;
static PyObject *__pyx_n_s_resultSaveMean;
static PyObject *__pyx_n_s_rnnDesc;
static PyObject *__pyx_n_s_samplerType;
static PyObject *__pyx_n_s_savedInvVariance;
static PyObject *__pyx_n_s_savedMean;
static PyObject *__pyx_n_s_seed;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_seqLength;
static PyObject *__pyx_n_s_seqLengthArray;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_srcData;
static PyObject *__pyx_n_s_srcDesc;
static PyObject *__pyx_n_s_srcDiffData;
static PyObject *__pyx_n_s_srcDiffDesc;
static PyObject *__pyx_n_s_stDesc;
static PyObject *__pyx_n_s_stateSizeInBytes;
static PyObject *__pyx_n_s_states;
static PyObject *__pyx_n_s_status;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_n_s_stream;
static PyObject *__pyx_n_s_strideA;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_tensorDesc;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_theta;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_u;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_valuePtr;
static PyObject *__pyx_n_s_varPack;
static PyObject *__pyx_n_s_vectorSize;
static PyObject *__pyx_n_s_verticalPadding;
static PyObject *__pyx_n_s_verticalStride;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_wDesc;
static PyObject *__pyx_n_s_wStride;
static PyObject *__pyx_n_s_windowDimA;
static PyObject *__pyx_n_s_windowHeight;
static PyObject *__pyx_n_s_windowWidth;
static PyObject *__pyx_n_s_workSpace;
static PyObject *__pyx_n_s_workSpaceSizeInBytes;
static PyObject *__pyx_n_s_workspace;
static PyObject *__pyx_n_s_workspaceSizeInBytes;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xDesc;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yDesc;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_n_s_zDesc;
static int __pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf___init__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self, PyObject *__pyx_v_algo, PyObject *__pyx_v_status, PyObject *__pyx_v_time, PyObject *__pyx_v_memory, PyObject *__pyx_v_determinism, PyObject *__pyx_v_mathType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_2__reduce_cython__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_4__setstate_cython__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_status); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_2add_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_4add_infos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infos); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_7__str___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_6__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_8__reduce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_check_status(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_status); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_2get_build_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_4getVersion(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_6queryRuntimeError(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_8create(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10destroy(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_12setStream(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stream); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_14getStream(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_16createTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_18setTensor4dDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_format, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_20setTensor4dDescriptorEx(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w, int __pyx_v_nStride, int __pyx_v_cStride, int __pyx_v_hStride, int __pyx_v_wStride); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_22getTensor4dDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_24setTensorNdDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA, size_t __pyx_v_strideA); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_26destroyTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_28addTensor_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_bDesc, size_t __pyx_v_b, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_30createOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_32setOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc, int __pyx_v_opTensorOp, int __pyx_v_opTensorCompType, int __pyx_v_opTensorNanOpt); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_34getOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_36destroyOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_38opTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_opTensorDesc, size_t __pyx_v_alpha1, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_alpha2, size_t __pyx_v_bDesc, size_t __pyx_v_B, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_40createReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_42setReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc, int __pyx_v_reduceTensorOp, int __pyx_v_reduceTensorCompType, int __pyx_v_reduceTensorNanOpt, int __pyx_v_reduceTensorIndices, int __pyx_v_reduceTensorIndicesType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_44getReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_46destroyReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_48getReductionIndicesSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_50getReductionWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_52reduceTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_indices, size_t __pyx_v_indicesSizeInBytes, size_t __pyx_v_workspace, size_t __pyx_v_workspaceSizeInBytes, size_t __pyx_v_alpha, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_54setTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_valuePtr); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_56scaleTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_58createFilterDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_60setFilter4dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_k, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_62setFilterNdDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_nbDims, size_t __pyx_v_filterDimA); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_64getFilterNdDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_wDesc, int __pyx_v_nbDimsRequested); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_66destroyFilterDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_68createConvolutionDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_70setConvolutionMathType(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, size_t __pyx_v_mathType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_72getConvolutionMathType(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_74setConvolutionGroupCount(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_groupCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_76getConvolutionGroupCount(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_78setConvolution2dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_80setConvolution2dDescriptor_v5(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode, size_t __pyx_v_computeType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_82setConvolutionNdDescriptor_v3(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_arrayLength, size_t __pyx_v_padA, size_t __pyx_v_filterStrideA, size_t __pyx_v_dilationA, int __pyx_v_mode, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_84destroyConvolutionDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_86findConvolutionForwardAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_88findConvolutionForwardAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_90findConvolutionForwardAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_92getConvolutionForwardAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_94getConvolutionForwardAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_96getConvolutionForwardWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_algo); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_98convolutionForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_100convolutionBackwardBias(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_102findConvolutionBackwardFilterAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_104findConvolutionBackwardFilterAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_106findConvolutionBackwardFilterAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_108getConvolutionBackwardFilterAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_110getConvolutionBackwardFilterAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_112getConvolutionBackwardFilterWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_algo); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_114convolutionBackwardFilter_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_116findConvolutionBackwardDataAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_118findConvolutionBackwardDataAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_120findConvolutionBackwardDataAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_122getConvolutionBackwardDataAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, size_t __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_124getConvolutionBackwardDataAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_126getConvolutionBackwardDataWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_algo); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_128convolutionBackwardData_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_130createPoolingDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_132setPooling2dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_windowHeight, int __pyx_v_windowWidth, int __pyx_v_verticalPadding, int __pyx_v_horizontalPadding, int __pyx_v_verticalStride, int __pyx_v_horizontalStride); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_134setPoolingNdDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_nbDims, size_t __pyx_v_windowDimA, size_t __pyx_v_paddingA, size_t __pyx_v_strideA); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_136destroyPoolingDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_138poolingForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_140poolingBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_142deriveBNTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_derivedBnDesc, size_t __pyx_v_xDesc, int __pyx_v_mode); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_144batchNormalizationForwardTraining(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_146batchNormalizationForwardInference(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, size_t __pyx_v_estimatedMean, size_t __pyx_v_estimatedVariance, double __pyx_v_epsilon); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_148batchNormalizationBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScale, size_t __pyx_v_dBnScaleResult, size_t __pyx_v_dBnBiasResult, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_150batchNormalizationForwardTrainingEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_zDesc, size_t __pyx_v_z, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_152getBatchNormalizationForwardTrainingExWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_zDesc, size_t __pyx_v_yDesc, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_activationDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_154batchNormalizationBackwardEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnops, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dzDesc, size_t __pyx_v_dz, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScaleData, size_t __pyx_v_bnBiasData, size_t __pyx_v_dBnScaleData, size_t __pyx_v_dBnBiasData, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_156getBatchNormalizationBackwardExWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_yDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dzDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_activationDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_158getBatchNormalizationTrainingExReserveSpaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_activationDesc, size_t __pyx_v_xDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_160createActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_162setActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_activationDesc, int __pyx_v_mode, int __pyx_v_reluNanOpt, double __pyx_v_reluCeiling); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_164destroyActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_activationDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_166softmaxForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_168softmaxBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_170activationForward_v4(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_172activationBackward_v4(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_174createDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_176destroyDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_dropoutDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_178dropoutGetStatesSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_180setDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_dropoutDesc, intptr_t __pyx_v_handle, float __pyx_v_dropout, size_t __pyx_v_states, size_t __pyx_v_stateSizeInBytes, unsigned PY_LONG_LONG __pyx_v_seed); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_182getDropoutReserveSpaceSize(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_xDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_184dropoutForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_186dropoutBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dyData, size_t __pyx_v_dxDesc, size_t __pyx_v_dxData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_188createCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_190destroyCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_192setCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_194getCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_196getCTCLossWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_gradientsDesc, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_198CTCLoss(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_probs, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, size_t __pyx_v_costs, size_t __pyx_v_gradientsDesc, size_t __pyx_v_gradients, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_200createRNNDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_202destroyRNNDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_204createPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_minibatch, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_206setPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, size_t __pyx_v_plan); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_208destroyPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_plan); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_210setRNNDescriptor_v5(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_212setRNNDescriptor_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_algo, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_214setRNNPaddingMode(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_paddingMode); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_216getRNNPaddingMode(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_218createRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_220destroyRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_222setRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc, int __pyx_v_dataType, size_t __pyx_v_layout, int __pyx_v_maxSeqLength, int __pyx_v_batchSize, int __pyx_v_vectorSize, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_224getRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc, size_t __pyx_v_dataType, size_t __pyx_v_layout, size_t __pyx_v_maxSeqLength, size_t __pyx_v_batchSize, size_t __pyx_v_vectorSize, int __pyx_v_arrayLengthRequested, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_226getRNNWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_228getRNNTrainingReserveSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_230getRNNParamsSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, int __pyx_v_dataType); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_232getRNNLinLayerMatrixParams(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerMatDesc, size_t __pyx_v_linLayerMat); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_234getRNNLinLayerBiasParams(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerBiasDesc, size_t __pyx_v_linLayerBias); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_236RNNForwardInference(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_238RNNForwardTraining(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_240RNNBackwardData(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_242RNNBackwardWeights(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_244RNNForwardInferenceEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_246RNNForwardTrainingEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_248RNNBackwardDataEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dcDesc, size_t __pyx_v_dcAttn, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_dkDesc, size_t __pyx_v_dkeys, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_250RNNBackwardWeightsEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_252createSpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_254destroySpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_stDesc); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_256setSpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_stDesc, size_t __pyx_v_samplerType, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_258spatialTfGridGeneratorForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_theta, size_t __pyx_v_grid); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_260spatialTfGridGeneratorBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_dgrid, size_t __pyx_v_dtheta); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_262spatialTfSamplerForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_grid, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_264spatialTfSamplerBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_beta, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_alphaDgrid, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_grid, size_t __pyx_v_betaDgrid, size_t __pyx_v_dgrid); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_266createFusedOpsConstParamPack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_268destroyFusedOpsConstParamPack(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_270setFusedOpsConstParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_272getFusedOpsConstParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_274createFusedOpsVariantParamPack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_276destroyFusedOpsVariantParamPack(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_278setFusedOpsVariantParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_280getFusedOpsVariantParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_282createFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_284destroyFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_plan); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_286makeFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_constPack); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_288fusedOpsExecute(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_varPack); /* proto */
static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_290__pyx_unpickle_CuDNNAlgoPerf(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_4cuda_5cudnn_CuDNNAlgoPerf(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_149395766;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__14;
static PyObject *__pyx_codeobj__16;
/* Late includes */

/* "cupy/cuda/cudnn.pyx":743
 * cdef class CuDNNAlgoPerf:
 * 
 *     def __init__(self, algo, status, time, memory, determinism, mathType):             # <<<<<<<<<<<<<<
 *         self.algo = algo
 *         self.status = status
 */

/* Python wrapper */
static int __pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_algo = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_time = 0;
  PyObject *__pyx_v_memory = 0;
  PyObject *__pyx_v_determinism = 0;
  PyObject *__pyx_v_mathType = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_algo,&__pyx_n_s_status,&__pyx_n_s_time,&__pyx_n_s_memory,&__pyx_n_s_determinism,&__pyx_n_s_mathType,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); __PYX_ERR(0, 743, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); __PYX_ERR(0, 743, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_memory)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); __PYX_ERR(0, 743, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_determinism)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); __PYX_ERR(0, 743, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mathType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); __PYX_ERR(0, 743, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 743, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_algo = values[0];
    __pyx_v_status = values[1];
    __pyx_v_time = values[2];
    __pyx_v_memory = values[3];
    __pyx_v_determinism = values[4];
    __pyx_v_mathType = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 743, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNAlgoPerf.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf___init__(((struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *)__pyx_v_self), __pyx_v_algo, __pyx_v_status, __pyx_v_time, __pyx_v_memory, __pyx_v_determinism, __pyx_v_mathType);

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

static int __pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf___init__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self, PyObject *__pyx_v_algo, PyObject *__pyx_v_status, PyObject *__pyx_v_time, PyObject *__pyx_v_memory, PyObject *__pyx_v_determinism, PyObject *__pyx_v_mathType) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  float __pyx_t_2;
  size_t __pyx_t_3;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/cuda/cudnn.pyx":744
 * 
 *     def __init__(self, algo, status, time, memory, determinism, mathType):
 *         self.algo = algo             # <<<<<<<<<<<<<<
 *         self.status = status
 *         self.time = time
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_algo); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 744, __pyx_L1_error)
  __pyx_v_self->algo = __pyx_t_1;

  /* "cupy/cuda/cudnn.pyx":745
 *     def __init__(self, algo, status, time, memory, determinism, mathType):
 *         self.algo = algo
 *         self.status = status             # <<<<<<<<<<<<<<
 *         self.time = time
 *         self.memory = memory
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_status); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 745, __pyx_L1_error)
  __pyx_v_self->status = __pyx_t_1;

  /* "cupy/cuda/cudnn.pyx":746
 *         self.algo = algo
 *         self.status = status
 *         self.time = time             # <<<<<<<<<<<<<<
 *         self.memory = memory
 *         self.determinism = determinism
 */
  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_v_time); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 746, __pyx_L1_error)
  __pyx_v_self->time = __pyx_t_2;

  /* "cupy/cuda/cudnn.pyx":747
 *         self.status = status
 *         self.time = time
 *         self.memory = memory             # <<<<<<<<<<<<<<
 *         self.determinism = determinism
 *         self.mathType = mathType
 */
  __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_memory); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 747, __pyx_L1_error)
  __pyx_v_self->memory = __pyx_t_3;

  /* "cupy/cuda/cudnn.pyx":748
 *         self.time = time
 *         self.memory = memory
 *         self.determinism = determinism             # <<<<<<<<<<<<<<
 *         self.mathType = mathType
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_determinism); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L1_error)
  __pyx_v_self->determinism = __pyx_t_1;

  /* "cupy/cuda/cudnn.pyx":749
 *         self.memory = memory
 *         self.determinism = determinism
 *         self.mathType = mathType             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_mathType); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L1_error)
  __pyx_v_self->mathType = __pyx_t_1;

  /* "cupy/cuda/cudnn.pyx":743
 * cdef class CuDNNAlgoPerf:
 * 
 *     def __init__(self, algo, status, time, memory, determinism, mathType):             # <<<<<<<<<<<<<<
 *         self.algo = algo
 *         self.status = status
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNAlgoPerf.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_2__reduce_cython__[] = "CuDNNAlgoPerf.__reduce_cython__(self)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_2__reduce_cython__(((struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *)__pyx_v_self));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_2__reduce_cython__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self) {
  int __pyx_v_use_setstate;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v__dict = 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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->algo); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->determinism); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->mathType); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_self->memory); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->status); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->time); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
  __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 = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_7 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v__dict = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "(tree fragment)":5
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_8 = (__pyx_v__dict != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v__dict);
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "(tree fragment)":7
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":5
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":9
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, None), state
 *     else:
 */
  __pyx_t_9 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_9) {

    /* "(tree fragment)":11
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_CuDNNAlgoPerf); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 11, __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))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_149395766);
    __Pyx_GIVEREF(__pyx_int_149395766);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_149395766);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, None), state
 *     else:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CuDNNAlgoPerf__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_CuDNNAlgoPerf); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 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))));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_149395766);
    __Pyx_GIVEREF(__pyx_int_149395766);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_149395766);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_state);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __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 bint use_setstate
 *     state = (self.algo, self.determinism, self.mathType, self.memory, self.status, self.time)
 */

  /* 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.cuda.cudnn.CuDNNAlgoPerf.__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)":14
 *     else:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CuDNNAlgoPerf__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_4__setstate_cython__[] = "CuDNNAlgoPerf.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_4__setstate_cython__(((struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_4__setstate_cython__(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":15
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_CuDNNAlgoPerf__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn___pyx_unpickle_CuDNNAlgoPerf__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_CuDNNAlgoPerf, (type(self), 0x8e79936, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_CuDNNAlgoPerf__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_AddTraceback("cupy.cuda.cudnn.CuDNNAlgoPerf.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":758
 * class CuDNNError(RuntimeError):
 * 
 *     def __init__(self, int status):             # <<<<<<<<<<<<<<
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError___init__[] = "CuDNNError.__init__(self, int status)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_1__init__ = {"__init__", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError___init__};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  int __pyx_v_status;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_status,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 758, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 758, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_status = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_status == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 758, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 758, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError___init__(__pyx_self, __pyx_v_self, __pyx_v_status);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_status) {
  char const *__pyx_v_msg;
  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;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cupy/cuda/cudnn.pyx":759
 * 
 *     def __init__(self, int status):
 *         self.status = status             # <<<<<<<<<<<<<<
 *         msg = cudnnGetErrorString(<Status>status)
 *         super(CuDNNError, self).__init__(
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status, __pyx_t_1) < 0) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":760
 *     def __init__(self, int status):
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)             # <<<<<<<<<<<<<<
 *         super(CuDNNError, self).__init__(
 *             'cuDNN Error: {}'.format(msg.decode()))
 */
  __pyx_v_msg = cudnnGetErrorString(((cudnnStatus_t)__pyx_v_status));

  /* "cupy/cuda/cudnn.pyx":761
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)
 *         super(CuDNNError, self).__init__(             # <<<<<<<<<<<<<<
 *             'cuDNN Error: {}'.format(msg.decode()))
 *         self._infos = []
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CuDNNError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/cuda/cudnn.pyx":762
 *         msg = cudnnGetErrorString(<Status>status)
 *         super(CuDNNError, self).__init__(
 *             'cuDNN Error: {}'.format(msg.decode()))             # <<<<<<<<<<<<<<
 *         self._infos = []
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_cuDNN_Error, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":763
 *         super(CuDNNError, self).__init__(
 *             'cuDNN Error: {}'.format(msg.decode()))
 *         self._infos = []             # <<<<<<<<<<<<<<
 * 
 *     def add_info(self, info):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_infos, __pyx_t_1) < 0) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":758
 * class CuDNNError(RuntimeError):
 * 
 *     def __init__(self, int status):             # <<<<<<<<<<<<<<
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)
 */

  /* 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_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.cuda.cudnn.CuDNNError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":765
 *         self._infos = []
 * 
 *     def add_info(self, info):             # <<<<<<<<<<<<<<
 *         assert isinstance(info, str)
 *         self._infos.append(info)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_3add_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_2add_info[] = "CuDNNError.add_info(self, info)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_3add_info = {"add_info", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_3add_info, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_2add_info};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_3add_info(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_info = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_info (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_info,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_info)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_info", 1, 2, 2, 1); __PYX_ERR(0, 765, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_info") < 0)) __PYX_ERR(0, 765, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_info = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_info", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 765, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.add_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_2add_info(__pyx_self, __pyx_v_self, __pyx_v_info);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_2add_info(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("add_info", 0);

  /* "cupy/cuda/cudnn.pyx":766
 * 
 *     def add_info(self, info):
 *         assert isinstance(info, str)             # <<<<<<<<<<<<<<
 *         self._infos.append(info)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyUnicode_Check(__pyx_v_info); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 766, __pyx_L1_error)
    }
  }
  #endif

  /* "cupy/cuda/cudnn.pyx":767
 *     def add_info(self, info):
 *         assert isinstance(info, str)
 *         self._infos.append(info)             # <<<<<<<<<<<<<<
 * 
 *     def add_infos(self, infos):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_infos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_v_info); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/cuda/cudnn.pyx":765
 *         self._infos = []
 * 
 *     def add_info(self, info):             # <<<<<<<<<<<<<<
 *         assert isinstance(info, str)
 *         self._infos.append(info)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.add_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":769
 *         self._infos.append(info)
 * 
 *     def add_infos(self, infos):             # <<<<<<<<<<<<<<
 *         assert isinstance(infos, list)
 *         self._infos.extend(infos)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_5add_infos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_4add_infos[] = "CuDNNError.add_infos(self, infos)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_5add_infos = {"add_infos", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_5add_infos, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_4add_infos};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_5add_infos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_infos = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_infos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_infos_2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_infos_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_infos", 1, 2, 2, 1); __PYX_ERR(0, 769, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_infos") < 0)) __PYX_ERR(0, 769, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_infos = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_infos", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 769, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.add_infos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_4add_infos(__pyx_self, __pyx_v_self, __pyx_v_infos);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_4add_infos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infos) {
  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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("add_infos", 0);

  /* "cupy/cuda/cudnn.pyx":770
 * 
 *     def add_infos(self, infos):
 *         assert isinstance(infos, list)             # <<<<<<<<<<<<<<
 *         self._infos.extend(infos)
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyList_Check(__pyx_v_infos); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 770, __pyx_L1_error)
    }
  }
  #endif

  /* "cupy/cuda/cudnn.pyx":771
 *     def add_infos(self, infos):
 *         assert isinstance(infos, list)
 *         self._infos.extend(infos)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_infos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_infos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_infos};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_infos};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_infos);
      __Pyx_GIVEREF(__pyx_v_infos);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_infos);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cupy/cuda/cudnn.pyx":769
 *         self._infos.append(info)
 * 
 *     def add_infos(self, infos):             # <<<<<<<<<<<<<<
 *         assert isinstance(infos, list)
 *         self._infos.extend(infos)
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.add_infos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_7__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_6__str__[] = "CuDNNError.__str__(self)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_7__str__ = {"__str__", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_7__str__, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_6__str__};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_7__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_6__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_4cupy_4cuda_5cudnn_10CuDNNError_7__str___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cupy/cuda/cudnn.pyx":776
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 *             '\n  ' + info for info in self._infos)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_7__str___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr(__pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 776, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4cupy_4cuda_5cudnn_10CuDNNError_7__str___2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_CuDNNError___str___locals_genexp, __pyx_n_s_cupy_cuda_cudnn); if (unlikely(!gen)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.__str__.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_4cuda_5cudnn_10CuDNNError_7__str___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  __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, 776, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 776, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_infos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __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_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 776, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 776, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 776, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_info);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_info, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_kp_u_, __pyx_cur_scope->__pyx_v_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_6__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *__pyx_cur_scope;
  PyObject *__pyx_v_base = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);
  __pyx_cur_scope = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(__pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct____str__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 773, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "cupy/cuda/cudnn.pyx":774
 * 
 *     def __str__(self):
 *         base = super(CuDNNError, self).__str__()             # <<<<<<<<<<<<<<
 *         return base + ''.join(
 *             '\n  ' + info for info in self._infos)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CuDNNError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_base = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":775
 *     def __str__(self):
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(             # <<<<<<<<<<<<<<
 *             '\n  ' + info for info in self._infos)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cupy/cuda/cudnn.pyx":776
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 *             '\n  ' + info for info in self._infos)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_t_1 = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "cupy/cuda/cudnn.pyx":775
 *     def __str__(self):
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(             # <<<<<<<<<<<<<<
 *             '\n  ' + info for info in self._infos)
 * 
 */
  __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_v_base, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_base);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":778
 *             '\n  ' + info for info in self._infos)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (type(self), (self.status,))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_9__reduce__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_8__reduce__[] = "CuDNNError.__reduce__(self)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_9__reduce__ = {"__reduce__", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_9__reduce__, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_10CuDNNError_8__reduce__};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_10CuDNNError_9__reduce__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_8__reduce__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10CuDNNError_8__reduce__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cupy/cuda/cudnn.pyx":779
 * 
 *     def __reduce__(self):
 *         return (type(self), (self.status,))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_self)));
  __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_self)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(__pyx_v_self)));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":778
 *             '\n  ' + info for info in self._infos)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (type(self), (self.status,))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cupy.cuda.cudnn.CuDNNError.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":783
 * 
 * @cython.profile(False)
 * cpdef inline check_status(int status):             # <<<<<<<<<<<<<<
 *     if status != 0:
 *         raise CuDNNError(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_1check_status(PyObject *__pyx_self, PyObject *__pyx_arg_status); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4cupy_4cuda_5cudnn_check_status(int __pyx_v_status, CYTHON_UNUSED int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("check_status", 0);

  /* "cupy/cuda/cudnn.pyx":784
 * @cython.profile(False)
 * cpdef inline check_status(int status):
 *     if status != 0:             # <<<<<<<<<<<<<<
 *         raise CuDNNError(status)
 * 
 */
  __pyx_t_1 = ((__pyx_v_status != 0) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cupy/cuda/cudnn.pyx":785
 * cpdef inline check_status(int status):
 *     if status != 0:
 *         raise CuDNNError(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_CuDNNError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_status); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 785, __pyx_L1_error)

    /* "cupy/cuda/cudnn.pyx":784
 * @cython.profile(False)
 * cpdef inline check_status(int status):
 *     if status != 0:             # <<<<<<<<<<<<<<
 *         raise CuDNNError(status)
 * 
 */
  }

  /* "cupy/cuda/cudnn.pyx":783
 * 
 * @cython.profile(False)
 * cpdef inline check_status(int status):             # <<<<<<<<<<<<<<
 *     if status != 0:
 *         raise CuDNNError(status)
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy.cuda.cudnn.check_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_1check_status(PyObject *__pyx_self, PyObject *__pyx_arg_status); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_check_status[] = "check_status(int status)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_1check_status(PyObject *__pyx_self, PyObject *__pyx_arg_status) {
  int __pyx_v_status;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_status (wrapper)", 0);
  assert(__pyx_arg_status); {
    __pyx_v_status = __Pyx_PyInt_As_int(__pyx_arg_status); if (unlikely((__pyx_v_status == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.check_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_check_status(__pyx_self, ((int)__pyx_v_status));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_check_status(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_status) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("check_status", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __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.cuda.cudnn.check_status", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":792
 * ###############################################################################
 * 
 * def get_build_version():             # <<<<<<<<<<<<<<
 *     return CUDNN_VERSION
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_3get_build_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_2get_build_version[] = "get_build_version()";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_3get_build_version = {"get_build_version", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_3get_build_version, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_2get_build_version};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_3get_build_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_build_version (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_2get_build_version(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_2get_build_version(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_build_version", 0);

  /* "cupy/cuda/cudnn.pyx":793
 * 
 * def get_build_version():
 *     return CUDNN_VERSION             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(CUDNN_VERSION); 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;

  /* "cupy/cuda/cudnn.pyx":792
 * ###############################################################################
 * 
 * def get_build_version():             # <<<<<<<<<<<<<<
 *     return CUDNN_VERSION
 * 
 */

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

/* "cupy/cuda/cudnn.pyx":800
 * ###############################################################################
 * 
 * cpdef size_t getVersion() except? 0:             # <<<<<<<<<<<<<<
 *     return cudnnGetVersion()
 * 
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_5getVersion(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getVersion(CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVersion", 0);

  /* "cupy/cuda/cudnn.pyx":801
 * 
 * cpdef size_t getVersion() except? 0:
 *     return cudnnGetVersion()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = cudnnGetVersion();
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":800
 * ###############################################################################
 * 
 * cpdef size_t getVersion() except? 0:             # <<<<<<<<<<<<<<
 *     return cudnnGetVersion()
 * 
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_5getVersion(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_4getVersion[] = "getVersion() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_5getVersion(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getVersion (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_4getVersion(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_4getVersion(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getVersion", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getVersion(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":808
 * ###############################################################################
 * 
 * cpdef queryRuntimeError(intptr_t handle, int mode):             # <<<<<<<<<<<<<<
 *     cdef Status rstatus
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_7queryRuntimeError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_queryRuntimeError(intptr_t __pyx_v_handle, int __pyx_v_mode, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnStatus_t __pyx_v_rstatus;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("queryRuntimeError", 0);

  /* "cupy/cuda/cudnn.pyx":810
 * cpdef queryRuntimeError(intptr_t handle, int mode):
 *     cdef Status rstatus
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnQueryRuntimeError(<Handle>handle, &rstatus,
 *                                         <ErrQueryMode>mode, <RuntimeTag*>0)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":811
 *     cdef Status rstatus
 *     with nogil:
 *         status = cudnnQueryRuntimeError(<Handle>handle, &rstatus,             # <<<<<<<<<<<<<<
 *                                         <ErrQueryMode>mode, <RuntimeTag*>0)
 *     check_status(status)
 */
        __pyx_v_status = cudnnQueryRuntimeError(((cudnnHandle_t)__pyx_v_handle), (&__pyx_v_rstatus), ((cudnnErrQueryMode_t)__pyx_v_mode), ((cudnnRuntimeTag_t *)0));
      }

      /* "cupy/cuda/cudnn.pyx":810
 * cpdef queryRuntimeError(intptr_t handle, int mode):
 *     cdef Status rstatus
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnQueryRuntimeError(<Handle>handle, &rstatus,
 *                                         <ErrQueryMode>mode, <RuntimeTag*>0)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":813
 *         status = cudnnQueryRuntimeError(<Handle>handle, &rstatus,
 *                                         <ErrQueryMode>mode, <RuntimeTag*>0)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return rstatus
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":814
 *                                         <ErrQueryMode>mode, <RuntimeTag*>0)
 *     check_status(status)
 *     return rstatus             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnStatus_t(__pyx_v_rstatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":808
 * ###############################################################################
 * 
 * cpdef queryRuntimeError(intptr_t handle, int mode):             # <<<<<<<<<<<<<<
 *     cdef Status rstatus
 *     with nogil:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_7queryRuntimeError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_6queryRuntimeError[] = "queryRuntimeError(intptr_t handle, int mode)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_7queryRuntimeError(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("queryRuntimeError (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("queryRuntimeError", 1, 2, 2, 1); __PYX_ERR(0, 808, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "queryRuntimeError") < 0)) __PYX_ERR(0, 808, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("queryRuntimeError", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 808, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.queryRuntimeError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_6queryRuntimeError(__pyx_self, __pyx_v_handle, __pyx_v_mode);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_6queryRuntimeError(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("queryRuntimeError", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_queryRuntimeError(__pyx_v_handle, __pyx_v_mode, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __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.cuda.cudnn.queryRuntimeError", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":821
 * ###############################################################################
 * 
 * cpdef intptr_t create() except? 0:             # <<<<<<<<<<<<<<
 *     cdef Handle handle
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_9create(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static intptr_t __pyx_f_4cupy_4cuda_5cudnn_create(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnHandle_t __pyx_v_handle;
  int __pyx_v_status;
  intptr_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("create", 0);

  /* "cupy/cuda/cudnn.pyx":823
 * cpdef intptr_t create() except? 0:
 *     cdef Handle handle
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreate(&handle)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":824
 *     cdef Handle handle
 *     with nogil:
 *         status = cudnnCreate(&handle)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <intptr_t>handle
 */
        __pyx_v_status = cudnnCreate((&__pyx_v_handle));
      }

      /* "cupy/cuda/cudnn.pyx":823
 * cpdef intptr_t create() except? 0:
 *     cdef Handle handle
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreate(&handle)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":825
 *     with nogil:
 *         status = cudnnCreate(&handle)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <intptr_t>handle
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":826
 *         status = cudnnCreate(&handle)
 *     check_status(status)
 *     return <intptr_t>handle             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((intptr_t)__pyx_v_handle);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":821
 * ###############################################################################
 * 
 * cpdef intptr_t create() except? 0:             # <<<<<<<<<<<<<<
 *     cdef Handle handle
 *     with nogil:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_9create(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_8create[] = "create() -> intptr_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_9create(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_8create(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_8create(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  intptr_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("create", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_create(0); if (unlikely(__pyx_t_1 == ((intptr_t)0) && PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":829
 * 
 * 
 * cpdef destroy(intptr_t handle):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroy(<Handle>handle)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_11destroy(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroy(intptr_t __pyx_v_handle, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "cupy/cuda/cudnn.pyx":830
 * 
 * cpdef destroy(intptr_t handle):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroy(<Handle>handle)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":831
 * cpdef destroy(intptr_t handle):
 *     with nogil:
 *         status = cudnnDestroy(<Handle>handle)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
        __pyx_v_status = cudnnDestroy(((cudnnHandle_t)__pyx_v_handle));
      }

      /* "cupy/cuda/cudnn.pyx":830
 * 
 * cpdef destroy(intptr_t handle):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroy(<Handle>handle)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":832
 *     with nogil:
 *         status = cudnnDestroy(<Handle>handle)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":829
 * 
 * 
 * cpdef destroy(intptr_t handle):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroy(<Handle>handle)
 */

  /* 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.cuda.cudnn.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_11destroy(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_10destroy[] = "destroy(intptr_t handle)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_11destroy(PyObject *__pyx_self, PyObject *__pyx_arg_handle) {
  intptr_t __pyx_v_handle;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  assert(__pyx_arg_handle); {
    __pyx_v_handle = PyInt_AsSsize_t(__pyx_arg_handle); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 829, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_10destroy(__pyx_self, ((intptr_t)__pyx_v_handle));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_10destroy(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroy", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroy(__pyx_v_handle, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __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.cuda.cudnn.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":835
 * 
 * 
 * cpdef setStream(intptr_t handle, size_t stream):             # <<<<<<<<<<<<<<
 *     status = cudnnSetStream(<Handle>handle, <driver.Stream>stream)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13setStream(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setStream(intptr_t __pyx_v_handle, size_t __pyx_v_stream, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setStream", 0);

  /* "cupy/cuda/cudnn.pyx":836
 * 
 * cpdef setStream(intptr_t handle, size_t stream):
 *     status = cudnnSetStream(<Handle>handle, <driver.Stream>stream)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnSetStream(((cudnnHandle_t)__pyx_v_handle), ((cudaStream_t)__pyx_v_stream));

  /* "cupy/cuda/cudnn.pyx":837
 * cpdef setStream(intptr_t handle, size_t stream):
 *     status = cudnnSetStream(<Handle>handle, <driver.Stream>stream)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":835
 * 
 * 
 * cpdef setStream(intptr_t handle, size_t stream):             # <<<<<<<<<<<<<<
 *     status = cudnnSetStream(<Handle>handle, <driver.Stream>stream)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.setStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13setStream(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_12setStream[] = "setStream(intptr_t handle, size_t stream)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_13setStream(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_stream;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setStream (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_stream,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setStream", 1, 2, 2, 1); __PYX_ERR(0, 835, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setStream") < 0)) __PYX_ERR(0, 835, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 835, __pyx_L3_error)
    __pyx_v_stream = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_stream == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 835, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setStream", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 835, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_12setStream(__pyx_self, __pyx_v_handle, __pyx_v_stream);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_12setStream(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stream) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setStream", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_v_stream, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __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.cuda.cudnn.setStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":840
 * 
 * 
 * cpdef size_t getStream(intptr_t handle) except? 0:             # <<<<<<<<<<<<<<
 *     cdef driver.Stream stream
 *     status = cudnnGetStream(<Handle>handle, &stream)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_15getStream(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getStream(intptr_t __pyx_v_handle, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudaStream_t __pyx_v_stream;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getStream", 0);

  /* "cupy/cuda/cudnn.pyx":842
 * cpdef size_t getStream(intptr_t handle) except? 0:
 *     cdef driver.Stream stream
 *     status = cudnnGetStream(<Handle>handle, &stream)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>stream
 */
  __pyx_v_status = cudnnGetStream(((cudnnHandle_t)__pyx_v_handle), (&__pyx_v_stream));

  /* "cupy/cuda/cudnn.pyx":843
 *     cdef driver.Stream stream
 *     status = cudnnGetStream(<Handle>handle, &stream)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>stream
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":844
 *     status = cudnnGetStream(<Handle>handle, &stream)
 *     check_status(status)
 *     return <size_t>stream             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_stream);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":840
 * 
 * 
 * cpdef size_t getStream(intptr_t handle) except? 0:             # <<<<<<<<<<<<<<
 *     cdef driver.Stream stream
 *     status = cudnnGetStream(<Handle>handle, &stream)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_15getStream(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_14getStream[] = "getStream(intptr_t handle) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_15getStream(PyObject *__pyx_self, PyObject *__pyx_arg_handle) {
  intptr_t __pyx_v_handle;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getStream (wrapper)", 0);
  assert(__pyx_arg_handle); {
    __pyx_v_handle = PyInt_AsSsize_t(__pyx_arg_handle); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getStream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_14getStream(__pyx_self, ((intptr_t)__pyx_v_handle));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_14getStream(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getStream", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getStream(__pyx_v_handle, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":851
 * ###############################################################################
 * 
 * cpdef size_t createTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef TensorDescriptor descriptor
 *     status = cudnnCreateTensorDescriptor(&descriptor)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_17createTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createTensorDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnTensorDescriptor_t __pyx_v_descriptor;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":853
 * cpdef size_t createTensorDescriptor() except? 0:
 *     cdef TensorDescriptor descriptor
 *     status = cudnnCreateTensorDescriptor(&descriptor)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>descriptor
 */
  __pyx_v_status = cudnnCreateTensorDescriptor((&__pyx_v_descriptor));

  /* "cupy/cuda/cudnn.pyx":854
 *     cdef TensorDescriptor descriptor
 *     status = cudnnCreateTensorDescriptor(&descriptor)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>descriptor
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":855
 *     status = cudnnCreateTensorDescriptor(&descriptor)
 *     check_status(status)
 *     return <size_t>descriptor             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_descriptor);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":851
 * ###############################################################################
 * 
 * cpdef size_t createTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef TensorDescriptor descriptor
 *     status = cudnnCreateTensorDescriptor(&descriptor)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_17createTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_16createTensorDescriptor[] = "createTensorDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_17createTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createTensorDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_16createTensorDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_16createTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createTensorDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":858
 * 
 * 
 * cpdef setTensor4dDescriptor(size_t tensorDesc, int format, int dataType,             # <<<<<<<<<<<<<<
 *                             int n, int c, int h, int w):
 *     status = cudnnSetTensor4dDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_19setTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptor(size_t __pyx_v_tensorDesc, int __pyx_v_format, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor4dDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":860
 * cpdef setTensor4dDescriptor(size_t tensorDesc, int format, int dataType,
 *                             int n, int c, int h, int w):
 *     status = cudnnSetTensor4dDescriptor(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>tensorDesc, <TensorFormat>format,
 *         <DataType>dataType, n, c, h, w)
 */
  __pyx_v_status = cudnnSetTensor4dDescriptor(((cudnnTensorDescriptor_t)__pyx_v_tensorDesc), ((cudnnTensorFormat_t)__pyx_v_format), ((cudnnDataType_t)__pyx_v_dataType), __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w);

  /* "cupy/cuda/cudnn.pyx":863
 *         <TensorDescriptor>tensorDesc, <TensorFormat>format,
 *         <DataType>dataType, n, c, h, w)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":858
 * 
 * 
 * cpdef setTensor4dDescriptor(size_t tensorDesc, int format, int dataType,             # <<<<<<<<<<<<<<
 *                             int n, int c, int h, int w):
 *     status = cudnnSetTensor4dDescriptor(
 */

  /* 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.cuda.cudnn.setTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_19setTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_18setTensor4dDescriptor[] = "setTensor4dDescriptor(size_t tensorDesc, int format, int dataType, int n, int c, int h, int w)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_19setTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_tensorDesc;
  int __pyx_v_format;
  int __pyx_v_dataType;
  int __pyx_v_n;
  int __pyx_v_c;
  int __pyx_v_h;
  int __pyx_v_w;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTensor4dDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensorDesc,&__pyx_n_s_format,&__pyx_n_s_dataType,&__pyx_n_s_n,&__pyx_n_s_c,&__pyx_n_s_h,&__pyx_n_s_w,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tensorDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 1); __PYX_ERR(0, 858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 2); __PYX_ERR(0, 858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 3); __PYX_ERR(0, 858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 4); __PYX_ERR(0, 858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 5); __PYX_ERR(0, 858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, 6); __PYX_ERR(0, 858, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTensor4dDescriptor") < 0)) __PYX_ERR(0, 858, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_tensorDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_tensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L3_error)
    __pyx_v_format = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_format == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
    __pyx_v_c = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptor", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 858, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_18setTensor4dDescriptor(__pyx_self, __pyx_v_tensorDesc, __pyx_v_format, __pyx_v_dataType, __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_18setTensor4dDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_format, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor4dDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptor(__pyx_v_tensorDesc, __pyx_v_format, __pyx_v_dataType, __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __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.cuda.cudnn.setTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":866
 * 
 * 
 * cpdef setTensor4dDescriptorEx(size_t tensorDesc, int dataType,             # <<<<<<<<<<<<<<
 *                               int n, int c, int h, int w, int nStride,
 *                               int cStride, int hStride, int wStride):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_21setTensor4dDescriptorEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptorEx(size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w, int __pyx_v_nStride, int __pyx_v_cStride, int __pyx_v_hStride, int __pyx_v_wStride, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor4dDescriptorEx", 0);

  /* "cupy/cuda/cudnn.pyx":869
 *                               int n, int c, int h, int w, int nStride,
 *                               int cStride, int hStride, int wStride):
 *     status = cudnnSetTensor4dDescriptorEx(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>tensorDesc, <DataType>dataType, n, c, h, w,
 *         nStride, cStride, hStride, wStride)
 */
  __pyx_v_status = cudnnSetTensor4dDescriptorEx(((cudnnTensorDescriptor_t)__pyx_v_tensorDesc), ((cudnnDataType_t)__pyx_v_dataType), __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w, __pyx_v_nStride, __pyx_v_cStride, __pyx_v_hStride, __pyx_v_wStride);

  /* "cupy/cuda/cudnn.pyx":872
 *         <TensorDescriptor>tensorDesc, <DataType>dataType, n, c, h, w,
 *         nStride, cStride, hStride, wStride)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":866
 * 
 * 
 * cpdef setTensor4dDescriptorEx(size_t tensorDesc, int dataType,             # <<<<<<<<<<<<<<
 *                               int n, int c, int h, int w, int nStride,
 *                               int cStride, int hStride, int wStride):
 */

  /* 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.cuda.cudnn.setTensor4dDescriptorEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_21setTensor4dDescriptorEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_20setTensor4dDescriptorEx[] = "setTensor4dDescriptorEx(size_t tensorDesc, int dataType, int n, int c, int h, int w, int nStride, int cStride, int hStride, int wStride)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_21setTensor4dDescriptorEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_tensorDesc;
  int __pyx_v_dataType;
  int __pyx_v_n;
  int __pyx_v_c;
  int __pyx_v_h;
  int __pyx_v_w;
  int __pyx_v_nStride;
  int __pyx_v_cStride;
  int __pyx_v_hStride;
  int __pyx_v_wStride;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTensor4dDescriptorEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensorDesc,&__pyx_n_s_dataType,&__pyx_n_s_n,&__pyx_n_s_c,&__pyx_n_s_h,&__pyx_n_s_w,&__pyx_n_s_nStride,&__pyx_n_s_cStride,&__pyx_n_s_hStride,&__pyx_n_s_wStride,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tensorDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 1); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 2); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 3); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 4); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 5); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 6); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 7); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 8); __PYX_ERR(0, 866, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, 9); __PYX_ERR(0, 866, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTensor4dDescriptorEx") < 0)) __PYX_ERR(0, 866, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_tensorDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_tensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L3_error)
    __pyx_v_c = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L3_error)
    __pyx_v_nStride = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L3_error)
    __pyx_v_cStride = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_cStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 868, __pyx_L3_error)
    __pyx_v_hStride = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_hStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 868, __pyx_L3_error)
    __pyx_v_wStride = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_wStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 868, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTensor4dDescriptorEx", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setTensor4dDescriptorEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_20setTensor4dDescriptorEx(__pyx_self, __pyx_v_tensorDesc, __pyx_v_dataType, __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w, __pyx_v_nStride, __pyx_v_cStride, __pyx_v_hStride, __pyx_v_wStride);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_20setTensor4dDescriptorEx(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_n, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w, int __pyx_v_nStride, int __pyx_v_cStride, int __pyx_v_hStride, int __pyx_v_wStride) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor4dDescriptorEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptorEx(__pyx_v_tensorDesc, __pyx_v_dataType, __pyx_v_n, __pyx_v_c, __pyx_v_h, __pyx_v_w, __pyx_v_nStride, __pyx_v_cStride, __pyx_v_hStride, __pyx_v_wStride, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __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.cuda.cudnn.setTensor4dDescriptorEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":875
 * 
 * 
 * cpdef tuple getTensor4dDescriptor(size_t tensorDesc):             # <<<<<<<<<<<<<<
 *     cdef DataType dataType
 *     cdef int n, c, h, w, nStride, cStride, hStride, wStride
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_23getTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getTensor4dDescriptor(size_t __pyx_v_tensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnDataType_t __pyx_v_dataType;
  int __pyx_v_n;
  int __pyx_v_c;
  int __pyx_v_h;
  int __pyx_v_w;
  int __pyx_v_nStride;
  int __pyx_v_cStride;
  int __pyx_v_hStride;
  int __pyx_v_wStride;
  int __pyx_v_status;
  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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("getTensor4dDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":878
 *     cdef DataType dataType
 *     cdef int n, c, h, w, nStride, cStride, hStride, wStride
 *     status = cudnnGetTensor4dDescriptor(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>tensorDesc, &dataType,
 *         &n, &c, &h, &w, &nStride, &cStride, &hStride, &wStride)
 */
  __pyx_v_status = cudnnGetTensor4dDescriptor(((cudnnTensorDescriptor_t)__pyx_v_tensorDesc), (&__pyx_v_dataType), (&__pyx_v_n), (&__pyx_v_c), (&__pyx_v_h), (&__pyx_v_w), (&__pyx_v_nStride), (&__pyx_v_cStride), (&__pyx_v_hStride), (&__pyx_v_wStride));

  /* "cupy/cuda/cudnn.pyx":881
 *         <TensorDescriptor>tensorDesc, &dataType,
 *         &n, &c, &h, &w, &nStride, &cStride, &hStride, &wStride)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return dataType, n, c, h, w, nStride, cStride, hStride, wStride
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":882
 *         &n, &c, &h, &w, &nStride, &cStride, &hStride, &wStride)
 *     check_status(status)
 *     return dataType, n, c, h, w, nStride, cStride, hStride, wStride             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnDataType_t(__pyx_v_dataType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_nStride); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_cStride); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_hStride); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_wStride); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_t_9);
  __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_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_r = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":875
 * 
 * 
 * cpdef tuple getTensor4dDescriptor(size_t tensorDesc):             # <<<<<<<<<<<<<<
 *     cdef DataType dataType
 *     cdef int n, c, h, w, nStride, cStride, hStride, wStride
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_23getTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_22getTensor4dDescriptor[] = "getTensor4dDescriptor(size_t tensorDesc) -> tuple";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_23getTensor4dDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc) {
  size_t __pyx_v_tensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getTensor4dDescriptor (wrapper)", 0);
  assert(__pyx_arg_tensorDesc); {
    __pyx_v_tensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_tensorDesc); if (unlikely((__pyx_v_tensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_22getTensor4dDescriptor(__pyx_self, ((size_t)__pyx_v_tensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_22getTensor4dDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getTensor4dDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getTensor4dDescriptor(__pyx_v_tensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __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.cuda.cudnn.getTensor4dDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":885
 * 
 * 
 * cpdef setTensorNdDescriptor(size_t tensorDesc, int dataType, int nbDims,             # <<<<<<<<<<<<<<
 *                             size_t dimA, size_t strideA):
 *     status = cudnnSetTensorNdDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_25setTensorNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensorNdDescriptor(size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA, size_t __pyx_v_strideA, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensorNdDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":887
 * cpdef setTensorNdDescriptor(size_t tensorDesc, int dataType, int nbDims,
 *                             size_t dimA, size_t strideA):
 *     status = cudnnSetTensorNdDescriptor(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>tensorDesc, <DataType>dataType, nbDims,
 *         <int*>dimA, <int*>strideA)
 */
  __pyx_v_status = cudnnSetTensorNdDescriptor(((cudnnTensorDescriptor_t)__pyx_v_tensorDesc), ((cudnnDataType_t)__pyx_v_dataType), __pyx_v_nbDims, ((int *)__pyx_v_dimA), ((int *)__pyx_v_strideA));

  /* "cupy/cuda/cudnn.pyx":890
 *         <TensorDescriptor>tensorDesc, <DataType>dataType, nbDims,
 *         <int*>dimA, <int*>strideA)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":885
 * 
 * 
 * cpdef setTensorNdDescriptor(size_t tensorDesc, int dataType, int nbDims,             # <<<<<<<<<<<<<<
 *                             size_t dimA, size_t strideA):
 *     status = cudnnSetTensorNdDescriptor(
 */

  /* 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.cuda.cudnn.setTensorNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_25setTensorNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_24setTensorNdDescriptor[] = "setTensorNdDescriptor(size_t tensorDesc, int dataType, int nbDims, size_t dimA, size_t strideA)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_25setTensorNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_tensorDesc;
  int __pyx_v_dataType;
  int __pyx_v_nbDims;
  size_t __pyx_v_dimA;
  size_t __pyx_v_strideA;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTensorNdDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tensorDesc,&__pyx_n_s_dataType,&__pyx_n_s_nbDims,&__pyx_n_s_dimA,&__pyx_n_s_strideA,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tensorDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensorNdDescriptor", 1, 5, 5, 1); __PYX_ERR(0, 885, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbDims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensorNdDescriptor", 1, 5, 5, 2); __PYX_ERR(0, 885, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensorNdDescriptor", 1, 5, 5, 3); __PYX_ERR(0, 885, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strideA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensorNdDescriptor", 1, 5, 5, 4); __PYX_ERR(0, 885, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTensorNdDescriptor") < 0)) __PYX_ERR(0, 885, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_tensorDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_tensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
    __pyx_v_nbDims = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nbDims == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
    __pyx_v_dimA = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dimA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
    __pyx_v_strideA = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_strideA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTensorNdDescriptor", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 885, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setTensorNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_24setTensorNdDescriptor(__pyx_self, __pyx_v_tensorDesc, __pyx_v_dataType, __pyx_v_nbDims, __pyx_v_dimA, __pyx_v_strideA);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_24setTensorNdDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA, size_t __pyx_v_strideA) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensorNdDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setTensorNdDescriptor(__pyx_v_tensorDesc, __pyx_v_dataType, __pyx_v_nbDims, __pyx_v_dimA, __pyx_v_strideA, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __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.cuda.cudnn.setTensorNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":893
 * 
 * 
 * cpdef destroyTensorDescriptor(size_t tensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyTensorDescriptor(<TensorDescriptor>tensorDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_27destroyTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyTensorDescriptor(size_t __pyx_v_tensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":894
 * 
 * cpdef destroyTensorDescriptor(size_t tensorDesc):
 *     status = cudnnDestroyTensorDescriptor(<TensorDescriptor>tensorDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyTensorDescriptor(((cudnnTensorDescriptor_t)__pyx_v_tensorDesc));

  /* "cupy/cuda/cudnn.pyx":895
 * cpdef destroyTensorDescriptor(size_t tensorDesc):
 *     status = cudnnDestroyTensorDescriptor(<TensorDescriptor>tensorDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":893
 * 
 * 
 * cpdef destroyTensorDescriptor(size_t tensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyTensorDescriptor(<TensorDescriptor>tensorDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_27destroyTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_26destroyTensorDescriptor[] = "destroyTensorDescriptor(size_t tensorDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_27destroyTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_tensorDesc) {
  size_t __pyx_v_tensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyTensorDescriptor (wrapper)", 0);
  assert(__pyx_arg_tensorDesc); {
    __pyx_v_tensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_tensorDesc); if (unlikely((__pyx_v_tensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 893, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_26destroyTensorDescriptor(__pyx_self, ((size_t)__pyx_v_tensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_26destroyTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_tensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyTensorDescriptor(__pyx_v_tensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 893, __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.cuda.cudnn.destroyTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":898
 * 
 * 
 * cpdef addTensor_v3(intptr_t handle, size_t alpha, size_t bDesc,             # <<<<<<<<<<<<<<
 *                    size_t b, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_29addTensor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_addTensor_v3(intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_bDesc, size_t __pyx_v_b, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("addTensor_v3", 0);

  /* "cupy/cuda/cudnn.pyx":900
 * cpdef addTensor_v3(intptr_t handle, size_t alpha, size_t bDesc,
 *                    size_t b, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnAddTensor_v3(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":901
 *                    size_t b, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnAddTensor_v3(
 *             <Handle>handle, <void*>alpha, <TensorDescriptor>bDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":902
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnAddTensor_v3(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <void*>alpha, <TensorDescriptor>bDesc,
 *             <void*>b, <void*>beta, <TensorDescriptor>yDesc, <void*>y)
 */
        __pyx_v_status = cudnnAddTensor_v3(((cudnnHandle_t)__pyx_v_handle), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_bDesc), ((void *)__pyx_v_b), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y));
      }

      /* "cupy/cuda/cudnn.pyx":901
 *                    size_t b, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnAddTensor_v3(
 *             <Handle>handle, <void*>alpha, <TensorDescriptor>bDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":905
 *             <Handle>handle, <void*>alpha, <TensorDescriptor>bDesc,
 *             <void*>b, <void*>beta, <TensorDescriptor>yDesc, <void*>y)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":898
 * 
 * 
 * cpdef addTensor_v3(intptr_t handle, size_t alpha, size_t bDesc,             # <<<<<<<<<<<<<<
 *                    size_t b, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

  /* 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.cuda.cudnn.addTensor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_29addTensor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_28addTensor_v3[] = "addTensor_v3(intptr_t handle, size_t alpha, size_t bDesc, size_t b, size_t beta, size_t yDesc, size_t y)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_29addTensor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_alpha;
  size_t __pyx_v_bDesc;
  size_t __pyx_v_b;
  size_t __pyx_v_beta;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addTensor_v3 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_alpha,&__pyx_n_s_bDesc,&__pyx_n_s_b,&__pyx_n_s_beta,&__pyx_n_s_yDesc,&__pyx_n_s_y,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 1); __PYX_ERR(0, 898, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 2); __PYX_ERR(0, 898, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 3); __PYX_ERR(0, 898, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 4); __PYX_ERR(0, 898, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 5); __PYX_ERR(0, 898, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, 6); __PYX_ERR(0, 898, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addTensor_v3") < 0)) __PYX_ERR(0, 898, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L3_error)
    __pyx_v_bDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_bDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L3_error)
    __pyx_v_b = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_b == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addTensor_v3", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 898, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.addTensor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_28addTensor_v3(__pyx_self, __pyx_v_handle, __pyx_v_alpha, __pyx_v_bDesc, __pyx_v_b, __pyx_v_beta, __pyx_v_yDesc, __pyx_v_y);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_28addTensor_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_bDesc, size_t __pyx_v_b, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("addTensor_v3", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_addTensor_v3(__pyx_v_handle, __pyx_v_alpha, __pyx_v_bDesc, __pyx_v_b, __pyx_v_beta, __pyx_v_yDesc, __pyx_v_y, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __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.cuda.cudnn.addTensor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":912
 * ###############################################################################
 * 
 * cpdef size_t createOpTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef OpTensorDescriptor opTensorDesc
 *     status = cudnnCreateOpTensorDescriptor(&opTensorDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_31createOpTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createOpTensorDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnOpTensorDescriptor_t __pyx_v_opTensorDesc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createOpTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":914
 * cpdef size_t createOpTensorDescriptor() except? 0:
 *     cdef OpTensorDescriptor opTensorDesc
 *     status = cudnnCreateOpTensorDescriptor(&opTensorDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>opTensorDesc
 */
  __pyx_v_status = cudnnCreateOpTensorDescriptor((&__pyx_v_opTensorDesc));

  /* "cupy/cuda/cudnn.pyx":915
 *     cdef OpTensorDescriptor opTensorDesc
 *     status = cudnnCreateOpTensorDescriptor(&opTensorDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>opTensorDesc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":916
 *     status = cudnnCreateOpTensorDescriptor(&opTensorDesc)
 *     check_status(status)
 *     return <size_t>opTensorDesc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_opTensorDesc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":912
 * ###############################################################################
 * 
 * cpdef size_t createOpTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef OpTensorDescriptor opTensorDesc
 *     status = cudnnCreateOpTensorDescriptor(&opTensorDesc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_31createOpTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_30createOpTensorDescriptor[] = "createOpTensorDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_31createOpTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createOpTensorDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_30createOpTensorDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_30createOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createOpTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createOpTensorDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":919
 * 
 * 
 * cpdef setOpTensorDescriptor(size_t opTensorDesc, int opTensorOp,             # <<<<<<<<<<<<<<
 *                             int opTensorCompType, int opTensorNanOpt):
 *     status = cudnnSetOpTensorDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_33setOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setOpTensorDescriptor(size_t __pyx_v_opTensorDesc, int __pyx_v_opTensorOp, int __pyx_v_opTensorCompType, int __pyx_v_opTensorNanOpt, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setOpTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":921
 * cpdef setOpTensorDescriptor(size_t opTensorDesc, int opTensorOp,
 *                             int opTensorCompType, int opTensorNanOpt):
 *     status = cudnnSetOpTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <OpTensorDescriptor>opTensorDesc, <OpTensorOp>opTensorOp,
 *         <DataType>opTensorCompType, <NanPropagation>opTensorNanOpt)
 */
  __pyx_v_status = cudnnSetOpTensorDescriptor(((cudnnOpTensorDescriptor_t)__pyx_v_opTensorDesc), ((cudnnOpTensorOp_t)__pyx_v_opTensorOp), ((cudnnDataType_t)__pyx_v_opTensorCompType), ((cudnnNanPropagation_t)__pyx_v_opTensorNanOpt));

  /* "cupy/cuda/cudnn.pyx":924
 *         <OpTensorDescriptor>opTensorDesc, <OpTensorOp>opTensorOp,
 *         <DataType>opTensorCompType, <NanPropagation>opTensorNanOpt)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":919
 * 
 * 
 * cpdef setOpTensorDescriptor(size_t opTensorDesc, int opTensorOp,             # <<<<<<<<<<<<<<
 *                             int opTensorCompType, int opTensorNanOpt):
 *     status = cudnnSetOpTensorDescriptor(
 */

  /* 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.cuda.cudnn.setOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_33setOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_32setOpTensorDescriptor[] = "setOpTensorDescriptor(size_t opTensorDesc, int opTensorOp, int opTensorCompType, int opTensorNanOpt)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_33setOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_opTensorDesc;
  int __pyx_v_opTensorOp;
  int __pyx_v_opTensorCompType;
  int __pyx_v_opTensorNanOpt;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setOpTensorDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_opTensorDesc,&__pyx_n_s_opTensorOp,&__pyx_n_s_opTensorCompType,&__pyx_n_s_opTensorNanOpt,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opTensorDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opTensorOp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOpTensorDescriptor", 1, 4, 4, 1); __PYX_ERR(0, 919, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opTensorCompType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOpTensorDescriptor", 1, 4, 4, 2); __PYX_ERR(0, 919, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opTensorNanOpt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setOpTensorDescriptor", 1, 4, 4, 3); __PYX_ERR(0, 919, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setOpTensorDescriptor") < 0)) __PYX_ERR(0, 919, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_opTensorDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_opTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L3_error)
    __pyx_v_opTensorOp = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_opTensorOp == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L3_error)
    __pyx_v_opTensorCompType = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_opTensorCompType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 920, __pyx_L3_error)
    __pyx_v_opTensorNanOpt = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_opTensorNanOpt == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 920, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setOpTensorDescriptor", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 919, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_32setOpTensorDescriptor(__pyx_self, __pyx_v_opTensorDesc, __pyx_v_opTensorOp, __pyx_v_opTensorCompType, __pyx_v_opTensorNanOpt);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_32setOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc, int __pyx_v_opTensorOp, int __pyx_v_opTensorCompType, int __pyx_v_opTensorNanOpt) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setOpTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setOpTensorDescriptor(__pyx_v_opTensorDesc, __pyx_v_opTensorOp, __pyx_v_opTensorCompType, __pyx_v_opTensorNanOpt, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __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.cuda.cudnn.setOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":927
 * 
 * 
 * cpdef getOpTensorDescriptor(size_t opTensorDesc):             # <<<<<<<<<<<<<<
 *     cdef OpTensorOp opTensorOp
 *     cdef DataType opTensorCompType
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_35getOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getOpTensorDescriptor(size_t __pyx_v_opTensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnOpTensorOp_t __pyx_v_opTensorOp;
  cudnnDataType_t __pyx_v_opTensorCompType;
  cudnnNanPropagation_t __pyx_v_opTensorNanOpt;
  int __pyx_v_status;
  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;
  __Pyx_RefNannySetupContext("getOpTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":931
 *     cdef DataType opTensorCompType
 *     cdef NanPropagation opTensorNanOpt
 *     status = cudnnGetOpTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <OpTensorDescriptor>opTensorDesc, &opTensorOp, &opTensorCompType,
 *         &opTensorNanOpt)
 */
  __pyx_v_status = cudnnGetOpTensorDescriptor(((cudnnOpTensorDescriptor_t)__pyx_v_opTensorDesc), (&__pyx_v_opTensorOp), (&__pyx_v_opTensorCompType), (&__pyx_v_opTensorNanOpt));

  /* "cupy/cuda/cudnn.pyx":934
 *         <OpTensorDescriptor>opTensorDesc, &opTensorOp, &opTensorCompType,
 *         &opTensorNanOpt)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return opTensorOp, opTensorCompType, opTensorNanOpt
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":935
 *         &opTensorNanOpt)
 *     check_status(status)
 *     return opTensorOp, opTensorCompType, opTensorNanOpt             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnOpTensorOp_t(__pyx_v_opTensorOp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_cudnnDataType_t(__pyx_v_opTensorCompType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_cudnnNanPropagation_t(__pyx_v_opTensorNanOpt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":927
 * 
 * 
 * cpdef getOpTensorDescriptor(size_t opTensorDesc):             # <<<<<<<<<<<<<<
 *     cdef OpTensorOp opTensorOp
 *     cdef DataType opTensorCompType
 */

  /* 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.cuda.cudnn.getOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_35getOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_34getOpTensorDescriptor[] = "getOpTensorDescriptor(size_t opTensorDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_35getOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc) {
  size_t __pyx_v_opTensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getOpTensorDescriptor (wrapper)", 0);
  assert(__pyx_arg_opTensorDesc); {
    __pyx_v_opTensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_opTensorDesc); if (unlikely((__pyx_v_opTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 927, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_34getOpTensorDescriptor(__pyx_self, ((size_t)__pyx_v_opTensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_34getOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getOpTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getOpTensorDescriptor(__pyx_v_opTensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __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.cuda.cudnn.getOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":938
 * 
 * 
 * cpdef destroyOpTensorDescriptor(size_t opTensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyOpTensorDescriptor(<OpTensorDescriptor>opTensorDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_37destroyOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyOpTensorDescriptor(size_t __pyx_v_opTensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyOpTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":939
 * 
 * cpdef destroyOpTensorDescriptor(size_t opTensorDesc):
 *     status = cudnnDestroyOpTensorDescriptor(<OpTensorDescriptor>opTensorDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyOpTensorDescriptor(((cudnnOpTensorDescriptor_t)__pyx_v_opTensorDesc));

  /* "cupy/cuda/cudnn.pyx":940
 * cpdef destroyOpTensorDescriptor(size_t opTensorDesc):
 *     status = cudnnDestroyOpTensorDescriptor(<OpTensorDescriptor>opTensorDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":938
 * 
 * 
 * cpdef destroyOpTensorDescriptor(size_t opTensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyOpTensorDescriptor(<OpTensorDescriptor>opTensorDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_37destroyOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_36destroyOpTensorDescriptor[] = "destroyOpTensorDescriptor(size_t opTensorDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_37destroyOpTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_opTensorDesc) {
  size_t __pyx_v_opTensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyOpTensorDescriptor (wrapper)", 0);
  assert(__pyx_arg_opTensorDesc); {
    __pyx_v_opTensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_opTensorDesc); if (unlikely((__pyx_v_opTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_36destroyOpTensorDescriptor(__pyx_self, ((size_t)__pyx_v_opTensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_36destroyOpTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_opTensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyOpTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyOpTensorDescriptor(__pyx_v_opTensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __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.cuda.cudnn.destroyOpTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":943
 * 
 * 
 * cpdef opTensor(intptr_t handle, size_t opTensorDesc, size_t alpha1,             # <<<<<<<<<<<<<<
 *                size_t aDesc, size_t A, size_t alpha2, size_t bDesc,
 *                size_t B, size_t beta, size_t cDesc, size_t C):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_39opTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_opTensor(intptr_t __pyx_v_handle, size_t __pyx_v_opTensorDesc, size_t __pyx_v_alpha1, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_alpha2, size_t __pyx_v_bDesc, size_t __pyx_v_B, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("opTensor", 0);

  /* "cupy/cuda/cudnn.pyx":946
 *                size_t aDesc, size_t A, size_t alpha2, size_t bDesc,
 *                size_t B, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnOpTensor(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":947
 *                size_t B, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnOpTensor(
 *             <Handle>handle, <OpTensorDescriptor>opTensorDesc, <void*>alpha1,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":948
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnOpTensor(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <OpTensorDescriptor>opTensorDesc, <void*>alpha1,
 *             <TensorDescriptor>aDesc, <void*>A, <void*>alpha2,
 */
        __pyx_v_status = cudnnOpTensor(((cudnnHandle_t)__pyx_v_handle), ((cudnnOpTensorDescriptor_t)__pyx_v_opTensorDesc), ((void *)__pyx_v_alpha1), ((cudnnTensorDescriptor_t)__pyx_v_aDesc), ((void *)__pyx_v_A), ((void *)__pyx_v_alpha2), ((cudnnTensorDescriptor_t)__pyx_v_bDesc), ((void *)__pyx_v_B), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_cDesc), ((void *)__pyx_v_C));
      }

      /* "cupy/cuda/cudnn.pyx":947
 *                size_t B, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnOpTensor(
 *             <Handle>handle, <OpTensorDescriptor>opTensorDesc, <void*>alpha1,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":953
 *             <TensorDescriptor>bDesc, <void*>B, <void*>beta,
 *             <TensorDescriptor>cDesc, <void*>C)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":943
 * 
 * 
 * cpdef opTensor(intptr_t handle, size_t opTensorDesc, size_t alpha1,             # <<<<<<<<<<<<<<
 *                size_t aDesc, size_t A, size_t alpha2, size_t bDesc,
 *                size_t B, size_t beta, size_t cDesc, size_t C):
 */

  /* 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.cuda.cudnn.opTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_39opTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_38opTensor[] = "opTensor(intptr_t handle, size_t opTensorDesc, size_t alpha1, size_t aDesc, size_t A, size_t alpha2, size_t bDesc, size_t B, size_t beta, size_t cDesc, size_t C)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_39opTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_opTensorDesc;
  size_t __pyx_v_alpha1;
  size_t __pyx_v_aDesc;
  size_t __pyx_v_A;
  size_t __pyx_v_alpha2;
  size_t __pyx_v_bDesc;
  size_t __pyx_v_B;
  size_t __pyx_v_beta;
  size_t __pyx_v_cDesc;
  size_t __pyx_v_C;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("opTensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_opTensorDesc,&__pyx_n_s_alpha1,&__pyx_n_s_aDesc,&__pyx_n_s_A,&__pyx_n_s_alpha2,&__pyx_n_s_bDesc,&__pyx_n_s_B,&__pyx_n_s_beta,&__pyx_n_s_cDesc,&__pyx_n_s_C,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opTensorDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 1); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 2); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 3); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 4); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 5); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 6); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 7); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 8); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 9); __PYX_ERR(0, 943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, 10); __PYX_ERR(0, 943, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "opTensor") < 0)) __PYX_ERR(0, 943, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error)
    __pyx_v_opTensorDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_opTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error)
    __pyx_v_alpha1 = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error)
    __pyx_v_aDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_aDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
    __pyx_v_A = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_A == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
    __pyx_v_alpha2 = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_alpha2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
    __pyx_v_bDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_bDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
    __pyx_v_B = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_B == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
    __pyx_v_C = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_C == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("opTensor", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 943, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.opTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_38opTensor(__pyx_self, __pyx_v_handle, __pyx_v_opTensorDesc, __pyx_v_alpha1, __pyx_v_aDesc, __pyx_v_A, __pyx_v_alpha2, __pyx_v_bDesc, __pyx_v_B, __pyx_v_beta, __pyx_v_cDesc, __pyx_v_C);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_38opTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_opTensorDesc, size_t __pyx_v_alpha1, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_alpha2, size_t __pyx_v_bDesc, size_t __pyx_v_B, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("opTensor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_opTensor(__pyx_v_handle, __pyx_v_opTensorDesc, __pyx_v_alpha1, __pyx_v_aDesc, __pyx_v_A, __pyx_v_alpha2, __pyx_v_bDesc, __pyx_v_B, __pyx_v_beta, __pyx_v_cDesc, __pyx_v_C, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __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.cuda.cudnn.opTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":960
 * ###############################################################################
 * 
 * cpdef size_t createReduceTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ReduceTensorDescriptor reduceTensorDesc
 *     status = cudnnCreateReduceTensorDescriptor(&reduceTensorDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_41createReduceTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createReduceTensorDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnReduceTensorDescriptor_t __pyx_v_reduceTensorDesc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createReduceTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":962
 * cpdef size_t createReduceTensorDescriptor() except? 0:
 *     cdef ReduceTensorDescriptor reduceTensorDesc
 *     status = cudnnCreateReduceTensorDescriptor(&reduceTensorDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>reduceTensorDesc
 */
  __pyx_v_status = cudnnCreateReduceTensorDescriptor((&__pyx_v_reduceTensorDesc));

  /* "cupy/cuda/cudnn.pyx":963
 *     cdef ReduceTensorDescriptor reduceTensorDesc
 *     status = cudnnCreateReduceTensorDescriptor(&reduceTensorDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>reduceTensorDesc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":964
 *     status = cudnnCreateReduceTensorDescriptor(&reduceTensorDesc)
 *     check_status(status)
 *     return <size_t>reduceTensorDesc             # <<<<<<<<<<<<<<
 * 
 * cpdef setReduceTensorDescriptor(
 */
  __pyx_r = ((size_t)__pyx_v_reduceTensorDesc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":960
 * ###############################################################################
 * 
 * cpdef size_t createReduceTensorDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ReduceTensorDescriptor reduceTensorDesc
 *     status = cudnnCreateReduceTensorDescriptor(&reduceTensorDesc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_41createReduceTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_40createReduceTensorDescriptor[] = "createReduceTensorDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_41createReduceTensorDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createReduceTensorDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_40createReduceTensorDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_40createReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createReduceTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createReduceTensorDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 960, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":966
 *     return <size_t>reduceTensorDesc
 * 
 * cpdef setReduceTensorDescriptor(             # <<<<<<<<<<<<<<
 *         size_t reduceTensorDesc, int reduceTensorOp, int reduceTensorCompType,
 *         int reduceTensorNanOpt, int reduceTensorIndices,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_43setReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setReduceTensorDescriptor(size_t __pyx_v_reduceTensorDesc, int __pyx_v_reduceTensorOp, int __pyx_v_reduceTensorCompType, int __pyx_v_reduceTensorNanOpt, int __pyx_v_reduceTensorIndices, int __pyx_v_reduceTensorIndicesType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setReduceTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":970
 *         int reduceTensorNanOpt, int reduceTensorIndices,
 *         int reduceTensorIndicesType):
 *     status = cudnnSetReduceTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <ReduceTensorDescriptor>reduceTensorDesc,
 *         <ReduceTensorOp>reduceTensorOp,
 */
  __pyx_v_status = cudnnSetReduceTensorDescriptor(((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc), ((cudnnReduceTensorOp_t)__pyx_v_reduceTensorOp), ((cudnnDataType_t)__pyx_v_reduceTensorCompType), ((cudnnNanPropagation_t)__pyx_v_reduceTensorNanOpt), ((cudnnReduceTensorIndices_t)__pyx_v_reduceTensorIndices), ((cudnnIndicesType_t)__pyx_v_reduceTensorIndicesType));

  /* "cupy/cuda/cudnn.pyx":976
 *         <ReduceTensorIndices>reduceTensorIndices,
 *         <IndicesType>reduceTensorIndicesType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":966
 *     return <size_t>reduceTensorDesc
 * 
 * cpdef setReduceTensorDescriptor(             # <<<<<<<<<<<<<<
 *         size_t reduceTensorDesc, int reduceTensorOp, int reduceTensorCompType,
 *         int reduceTensorNanOpt, int reduceTensorIndices,
 */

  /* 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.cuda.cudnn.setReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_43setReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_42setReduceTensorDescriptor[] = "setReduceTensorDescriptor(size_t reduceTensorDesc, int reduceTensorOp, int reduceTensorCompType, int reduceTensorNanOpt, int reduceTensorIndices, int reduceTensorIndicesType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_43setReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_reduceTensorDesc;
  int __pyx_v_reduceTensorOp;
  int __pyx_v_reduceTensorCompType;
  int __pyx_v_reduceTensorNanOpt;
  int __pyx_v_reduceTensorIndices;
  int __pyx_v_reduceTensorIndicesType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setReduceTensorDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reduceTensorDesc,&__pyx_n_s_reduceTensorOp,&__pyx_n_s_reduceTensorCompType,&__pyx_n_s_reduceTensorNanOpt,&__pyx_n_s_reduceTensorIndices,&__pyx_n_s_reduceTensorIndicesType,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorOp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, 1); __PYX_ERR(0, 966, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorCompType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, 2); __PYX_ERR(0, 966, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorNanOpt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, 3); __PYX_ERR(0, 966, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorIndices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, 4); __PYX_ERR(0, 966, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorIndicesType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, 5); __PYX_ERR(0, 966, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setReduceTensorDescriptor") < 0)) __PYX_ERR(0, 966, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 967, __pyx_L3_error)
    __pyx_v_reduceTensorOp = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_reduceTensorOp == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 967, __pyx_L3_error)
    __pyx_v_reduceTensorCompType = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_reduceTensorCompType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 967, __pyx_L3_error)
    __pyx_v_reduceTensorNanOpt = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_reduceTensorNanOpt == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 968, __pyx_L3_error)
    __pyx_v_reduceTensorIndices = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_reduceTensorIndices == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 968, __pyx_L3_error)
    __pyx_v_reduceTensorIndicesType = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_reduceTensorIndicesType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 969, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setReduceTensorDescriptor", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 966, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_42setReduceTensorDescriptor(__pyx_self, __pyx_v_reduceTensorDesc, __pyx_v_reduceTensorOp, __pyx_v_reduceTensorCompType, __pyx_v_reduceTensorNanOpt, __pyx_v_reduceTensorIndices, __pyx_v_reduceTensorIndicesType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_42setReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc, int __pyx_v_reduceTensorOp, int __pyx_v_reduceTensorCompType, int __pyx_v_reduceTensorNanOpt, int __pyx_v_reduceTensorIndices, int __pyx_v_reduceTensorIndicesType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setReduceTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setReduceTensorDescriptor(__pyx_v_reduceTensorDesc, __pyx_v_reduceTensorOp, __pyx_v_reduceTensorCompType, __pyx_v_reduceTensorNanOpt, __pyx_v_reduceTensorIndices, __pyx_v_reduceTensorIndicesType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __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.cuda.cudnn.setReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":979
 * 
 * 
 * cpdef getReduceTensorDescriptor(size_t reduceTensorDesc):             # <<<<<<<<<<<<<<
 *     cdef ReduceTensorOp redOp
 *     cdef DataType redCompType
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_45getReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getReduceTensorDescriptor(size_t __pyx_v_reduceTensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnReduceTensorOp_t __pyx_v_redOp;
  cudnnDataType_t __pyx_v_redCompType;
  cudnnNanPropagation_t __pyx_v_redNanOpt;
  cudnnReduceTensorIndices_t __pyx_v_redIndices;
  cudnnIndicesType_t __pyx_v_redIndicesType;
  int __pyx_v_status;
  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;
  __Pyx_RefNannySetupContext("getReduceTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":985
 *     cdef ReduceTensorIndices redIndices
 *     cdef IndicesType redIndicesType
 *     status = cudnnGetReduceTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <ReduceTensorDescriptor>reduceTensorDesc, &redOp,
 *         &redCompType, &redNanOpt, &redIndices, &redIndicesType)
 */
  __pyx_v_status = cudnnGetReduceTensorDescriptor(((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc), (&__pyx_v_redOp), (&__pyx_v_redCompType), (&__pyx_v_redNanOpt), (&__pyx_v_redIndices), (&__pyx_v_redIndicesType));

  /* "cupy/cuda/cudnn.pyx":988
 *         <ReduceTensorDescriptor>reduceTensorDesc, &redOp,
 *         &redCompType, &redNanOpt, &redIndices, &redIndicesType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return redOp, redCompType, redNanOpt, redIndices, redIndicesType
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":989
 *         &redCompType, &redNanOpt, &redIndices, &redIndicesType)
 *     check_status(status)
 *     return redOp, redCompType, redNanOpt, redIndices, redIndicesType             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnReduceTensorOp_t(__pyx_v_redOp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_cudnnDataType_t(__pyx_v_redCompType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_cudnnNanPropagation_t(__pyx_v_redNanOpt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_cudnnReduceTensorIndices_t(__pyx_v_redIndices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_cudnnIndicesType_t(__pyx_v_redIndicesType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":979
 * 
 * 
 * cpdef getReduceTensorDescriptor(size_t reduceTensorDesc):             # <<<<<<<<<<<<<<
 *     cdef ReduceTensorOp redOp
 *     cdef DataType redCompType
 */

  /* 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.cuda.cudnn.getReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_45getReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_44getReduceTensorDescriptor[] = "getReduceTensorDescriptor(size_t reduceTensorDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_45getReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc) {
  size_t __pyx_v_reduceTensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getReduceTensorDescriptor (wrapper)", 0);
  assert(__pyx_arg_reduceTensorDesc); {
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_reduceTensorDesc); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 979, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_44getReduceTensorDescriptor(__pyx_self, ((size_t)__pyx_v_reduceTensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_44getReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getReduceTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getReduceTensorDescriptor(__pyx_v_reduceTensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __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.cuda.cudnn.getReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":992
 * 
 * 
 * cpdef destroyReduceTensorDescriptor(size_t reduceTensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyReduceTensorDescriptor(
 *         <ReduceTensorDescriptor>reduceTensorDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_47destroyReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyReduceTensorDescriptor(size_t __pyx_v_reduceTensorDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyReduceTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":993
 * 
 * cpdef destroyReduceTensorDescriptor(size_t reduceTensorDesc):
 *     status = cudnnDestroyReduceTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <ReduceTensorDescriptor>reduceTensorDesc)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDestroyReduceTensorDescriptor(((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc));

  /* "cupy/cuda/cudnn.pyx":995
 *     status = cudnnDestroyReduceTensorDescriptor(
 *         <ReduceTensorDescriptor>reduceTensorDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":992
 * 
 * 
 * cpdef destroyReduceTensorDescriptor(size_t reduceTensorDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyReduceTensorDescriptor(
 *         <ReduceTensorDescriptor>reduceTensorDesc)
 */

  /* 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.cuda.cudnn.destroyReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_47destroyReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_46destroyReduceTensorDescriptor[] = "destroyReduceTensorDescriptor(size_t reduceTensorDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_47destroyReduceTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_reduceTensorDesc) {
  size_t __pyx_v_reduceTensorDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyReduceTensorDescriptor (wrapper)", 0);
  assert(__pyx_arg_reduceTensorDesc); {
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(__pyx_arg_reduceTensorDesc); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 992, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_46destroyReduceTensorDescriptor(__pyx_self, ((size_t)__pyx_v_reduceTensorDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_46destroyReduceTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_reduceTensorDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyReduceTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyReduceTensorDescriptor(__pyx_v_reduceTensorDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __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.cuda.cudnn.destroyReduceTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":998
 * 
 * 
 * cpdef size_t getReductionIndicesSize(intptr_t handle, size_t reduceTensorDesc,             # <<<<<<<<<<<<<<
 *                                      size_t aDesc, size_t cDesc) except? 0:
 *     cdef size_t sizeInBytes
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_49getReductionIndicesSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getReductionIndicesSize(intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getReductionIndicesSize", 0);

  /* "cupy/cuda/cudnn.pyx":1001
 *                                      size_t aDesc, size_t cDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetReductionIndicesSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 *         <TensorDescriptor>aDesc, <TensorDescriptor>cDesc, &sizeInBytes)
 */
  __pyx_v_status = cudnnGetReductionIndicesSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc), ((cudnnTensorDescriptor_t)__pyx_v_aDesc), ((cudnnTensorDescriptor_t)__pyx_v_cDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1004
 *         <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 *         <TensorDescriptor>aDesc, <TensorDescriptor>cDesc, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1005
 *         <TensorDescriptor>aDesc, <TensorDescriptor>cDesc, &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":998
 * 
 * 
 * cpdef size_t getReductionIndicesSize(intptr_t handle, size_t reduceTensorDesc,             # <<<<<<<<<<<<<<
 *                                      size_t aDesc, size_t cDesc) except? 0:
 *     cdef size_t sizeInBytes
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_49getReductionIndicesSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_48getReductionIndicesSize[] = "getReductionIndicesSize(intptr_t handle, size_t reduceTensorDesc, size_t aDesc, size_t cDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_49getReductionIndicesSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_reduceTensorDesc;
  size_t __pyx_v_aDesc;
  size_t __pyx_v_cDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getReductionIndicesSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_reduceTensorDesc,&__pyx_n_s_aDesc,&__pyx_n_s_cDesc,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionIndicesSize", 1, 4, 4, 1); __PYX_ERR(0, 998, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionIndicesSize", 1, 4, 4, 2); __PYX_ERR(0, 998, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionIndicesSize", 1, 4, 4, 3); __PYX_ERR(0, 998, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getReductionIndicesSize") < 0)) __PYX_ERR(0, 998, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error)
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error)
    __pyx_v_aDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_aDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 999, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 999, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getReductionIndicesSize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 998, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getReductionIndicesSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_48getReductionIndicesSize(__pyx_self, __pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_aDesc, __pyx_v_cDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_48getReductionIndicesSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getReductionIndicesSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getReductionIndicesSize(__pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_aDesc, __pyx_v_cDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1008
 * 
 * 
 * cpdef size_t getReductionWorkspaceSize(intptr_t handle,             # <<<<<<<<<<<<<<
 *                                        size_t reduceTensorDesc,
 *                                        size_t aDesc, size_t cDesc) except? 0:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_51getReductionWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getReductionWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getReductionWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1012
 *                                        size_t aDesc, size_t cDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetReductionWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 *         <TensorDescriptor>aDesc, <TensorDescriptor>cDesc,
 */
  __pyx_v_status = cudnnGetReductionWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc), ((cudnnTensorDescriptor_t)__pyx_v_aDesc), ((cudnnTensorDescriptor_t)__pyx_v_cDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1016
 *         <TensorDescriptor>aDesc, <TensorDescriptor>cDesc,
 *         &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1017
 *         &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1008
 * 
 * 
 * cpdef size_t getReductionWorkspaceSize(intptr_t handle,             # <<<<<<<<<<<<<<
 *                                        size_t reduceTensorDesc,
 *                                        size_t aDesc, size_t cDesc) except? 0:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_51getReductionWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_50getReductionWorkspaceSize[] = "getReductionWorkspaceSize(intptr_t handle, size_t reduceTensorDesc, size_t aDesc, size_t cDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_51getReductionWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_reduceTensorDesc;
  size_t __pyx_v_aDesc;
  size_t __pyx_v_cDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getReductionWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_reduceTensorDesc,&__pyx_n_s_aDesc,&__pyx_n_s_cDesc,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionWorkspaceSize", 1, 4, 4, 1); __PYX_ERR(0, 1008, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionWorkspaceSize", 1, 4, 4, 2); __PYX_ERR(0, 1008, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getReductionWorkspaceSize", 1, 4, 4, 3); __PYX_ERR(0, 1008, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getReductionWorkspaceSize") < 0)) __PYX_ERR(0, 1008, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L3_error)
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1009, __pyx_L3_error)
    __pyx_v_aDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_aDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1010, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1010, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getReductionWorkspaceSize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1008, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getReductionWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_50getReductionWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_aDesc, __pyx_v_cDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_50getReductionWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_aDesc, size_t __pyx_v_cDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getReductionWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getReductionWorkspaceSize(__pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_aDesc, __pyx_v_cDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1020
 * 
 * 
 * cpdef reduceTensor(intptr_t handle, size_t reduceTensorDesc, size_t indices,             # <<<<<<<<<<<<<<
 *                    size_t indicesSizeInBytes, size_t workspace,
 *                    size_t workspaceSizeInBytes, size_t alpha, size_t aDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_53reduceTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_reduceTensor(intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_indices, size_t __pyx_v_indicesSizeInBytes, size_t __pyx_v_workspace, size_t __pyx_v_workspaceSizeInBytes, size_t __pyx_v_alpha, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reduceTensor", 0);

  /* "cupy/cuda/cudnn.pyx":1024
 *                    size_t workspaceSizeInBytes, size_t alpha, size_t aDesc,
 *                    size_t A, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnReduceTensor(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1025
 *                    size_t A, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnReduceTensor(
 *             <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1026
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnReduceTensor(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 *             <void*>indices, indicesSizeInBytes, <void*>workspace,
 */
        __pyx_v_status = cudnnReduceTensor(((cudnnHandle_t)__pyx_v_handle), ((cudnnReduceTensorDescriptor_t)__pyx_v_reduceTensorDesc), ((void *)__pyx_v_indices), __pyx_v_indicesSizeInBytes, ((void *)__pyx_v_workspace), __pyx_v_workspaceSizeInBytes, ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_aDesc), ((void *)__pyx_v_A), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_cDesc), ((void *)__pyx_v_C));
      }

      /* "cupy/cuda/cudnn.pyx":1025
 *                    size_t A, size_t beta, size_t cDesc, size_t C):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnReduceTensor(
 *             <Handle>handle, <ReduceTensorDescriptor>reduceTensorDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1031
 *             workspaceSizeInBytes, <void*>alpha, <TensorDescriptor>aDesc,
 *             <void*>A, <void*>beta, <TensorDescriptor>cDesc, <void*>C)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1020
 * 
 * 
 * cpdef reduceTensor(intptr_t handle, size_t reduceTensorDesc, size_t indices,             # <<<<<<<<<<<<<<
 *                    size_t indicesSizeInBytes, size_t workspace,
 *                    size_t workspaceSizeInBytes, size_t alpha, size_t aDesc,
 */

  /* 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.cuda.cudnn.reduceTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_53reduceTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_52reduceTensor[] = "reduceTensor(intptr_t handle, size_t reduceTensorDesc, size_t indices, size_t indicesSizeInBytes, size_t workspace, size_t workspaceSizeInBytes, size_t alpha, size_t aDesc, size_t A, size_t beta, size_t cDesc, size_t C)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_53reduceTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_reduceTensorDesc;
  size_t __pyx_v_indices;
  size_t __pyx_v_indicesSizeInBytes;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workspaceSizeInBytes;
  size_t __pyx_v_alpha;
  size_t __pyx_v_aDesc;
  size_t __pyx_v_A;
  size_t __pyx_v_beta;
  size_t __pyx_v_cDesc;
  size_t __pyx_v_C;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reduceTensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_reduceTensorDesc,&__pyx_n_s_indices,&__pyx_n_s_indicesSizeInBytes,&__pyx_n_s_workspace,&__pyx_n_s_workspaceSizeInBytes,&__pyx_n_s_alpha,&__pyx_n_s_aDesc,&__pyx_n_s_A,&__pyx_n_s_beta,&__pyx_n_s_cDesc,&__pyx_n_s_C,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduceTensorDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 1); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 2); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indicesSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 3); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 4); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 5); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 6); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 7); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 8); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 9); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 10); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, 11); __PYX_ERR(0, 1020, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reduceTensor") < 0)) __PYX_ERR(0, 1020, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L3_error)
    __pyx_v_reduceTensorDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_reduceTensorDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L3_error)
    __pyx_v_indices = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_indices == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L3_error)
    __pyx_v_indicesSizeInBytes = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_indicesSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L3_error)
    __pyx_v_workspaceSizeInBytes = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_workspaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L3_error)
    __pyx_v_aDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_aDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1022, __pyx_L3_error)
    __pyx_v_A = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_A == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error)
    __pyx_v_C = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_C == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reduceTensor", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1020, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.reduceTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_52reduceTensor(__pyx_self, __pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_indices, __pyx_v_indicesSizeInBytes, __pyx_v_workspace, __pyx_v_workspaceSizeInBytes, __pyx_v_alpha, __pyx_v_aDesc, __pyx_v_A, __pyx_v_beta, __pyx_v_cDesc, __pyx_v_C);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_52reduceTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_reduceTensorDesc, size_t __pyx_v_indices, size_t __pyx_v_indicesSizeInBytes, size_t __pyx_v_workspace, size_t __pyx_v_workspaceSizeInBytes, size_t __pyx_v_alpha, size_t __pyx_v_aDesc, size_t __pyx_v_A, size_t __pyx_v_beta, size_t __pyx_v_cDesc, size_t __pyx_v_C) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("reduceTensor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_reduceTensor(__pyx_v_handle, __pyx_v_reduceTensorDesc, __pyx_v_indices, __pyx_v_indicesSizeInBytes, __pyx_v_workspace, __pyx_v_workspaceSizeInBytes, __pyx_v_alpha, __pyx_v_aDesc, __pyx_v_A, __pyx_v_beta, __pyx_v_cDesc, __pyx_v_C, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __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.cuda.cudnn.reduceTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1034
 * 
 * 
 * cpdef setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_55setTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setTensor(intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_valuePtr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor", 0);

  /* "cupy/cuda/cudnn.pyx":1035
 * 
 * cpdef setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSetTensor(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1036
 * cpdef setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetTensor(
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*>y,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1037
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSetTensor(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*>y,
 *             <void*>valuePtr)
 */
        __pyx_v_status = cudnnSetTensor(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((void *)__pyx_v_valuePtr));
      }

      /* "cupy/cuda/cudnn.pyx":1036
 * cpdef setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetTensor(
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*>y,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1040
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*>y,
 *             <void*>valuePtr)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1034
 * 
 * 
 * cpdef setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

  /* 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.cuda.cudnn.setTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_55setTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_54setTensor[] = "setTensor(intptr_t handle, size_t yDesc, size_t y, size_t valuePtr)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_55setTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_valuePtr;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setTensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_valuePtr,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor", 1, 4, 4, 1); __PYX_ERR(0, 1034, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor", 1, 4, 4, 2); __PYX_ERR(0, 1034, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuePtr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setTensor", 1, 4, 4, 3); __PYX_ERR(0, 1034, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setTensor") < 0)) __PYX_ERR(0, 1034, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L3_error)
    __pyx_v_valuePtr = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_valuePtr == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setTensor", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1034, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_54setTensor(__pyx_self, __pyx_v_handle, __pyx_v_yDesc, __pyx_v_y, __pyx_v_valuePtr);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_54setTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_valuePtr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setTensor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setTensor(__pyx_v_handle, __pyx_v_yDesc, __pyx_v_y, __pyx_v_valuePtr, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __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.cuda.cudnn.setTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1043
 * 
 * 
 * cpdef scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_57scaleTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_scaleTensor(intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_alpha, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("scaleTensor", 0);

  /* "cupy/cuda/cudnn.pyx":1044
 * 
 * cpdef scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnScaleTensor(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1045
 * cpdef scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnScaleTensor(
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*> y,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1046
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnScaleTensor(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*> y,
 *             <void*>alpha)
 */
        __pyx_v_status = cudnnScaleTensor(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((void *)__pyx_v_alpha));
      }

      /* "cupy/cuda/cudnn.pyx":1045
 * cpdef scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnScaleTensor(
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*> y,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1049
 *             <Handle>handle, <TensorDescriptor>yDesc, <void*> y,
 *             <void*>alpha)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1043
 * 
 * 
 * cpdef scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

  /* 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.cuda.cudnn.scaleTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_57scaleTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_56scaleTensor[] = "scaleTensor(intptr_t handle, size_t yDesc, size_t y, size_t alpha)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_57scaleTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_alpha;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scaleTensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_alpha,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scaleTensor", 1, 4, 4, 1); __PYX_ERR(0, 1043, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scaleTensor", 1, 4, 4, 2); __PYX_ERR(0, 1043, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scaleTensor", 1, 4, 4, 3); __PYX_ERR(0, 1043, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scaleTensor") < 0)) __PYX_ERR(0, 1043, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1043, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1043, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1043, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1043, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scaleTensor", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1043, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.scaleTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_56scaleTensor(__pyx_self, __pyx_v_handle, __pyx_v_yDesc, __pyx_v_y, __pyx_v_alpha);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_56scaleTensor(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("scaleTensor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_scaleTensor(__pyx_v_handle, __pyx_v_yDesc, __pyx_v_y, __pyx_v_alpha, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __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.cuda.cudnn.scaleTensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1056
 * ###############################################################################
 * 
 * cpdef size_t createFilterDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef FilterDescriptor desc
 *     status = cudnnCreateFilterDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_59createFilterDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createFilterDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnFilterDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFilterDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1058
 * cpdef size_t createFilterDescriptor() except? 0:
 *     cdef FilterDescriptor desc
 *     status = cudnnCreateFilterDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateFilterDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":1059
 *     cdef FilterDescriptor desc
 *     status = cudnnCreateFilterDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1060
 *     status = cudnnCreateFilterDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1056
 * ###############################################################################
 * 
 * cpdef size_t createFilterDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef FilterDescriptor desc
 *     status = cudnnCreateFilterDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_59createFilterDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_58createFilterDescriptor[] = "createFilterDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_59createFilterDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createFilterDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_58createFilterDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_58createFilterDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createFilterDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createFilterDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1056, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1063
 * 
 * 
 * cpdef setFilter4dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t filterDesc, int dataType,
 *         int format, int k, int c, int h, int w):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_61setFilter4dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFilter4dDescriptor_v4(size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_k, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFilter4dDescriptor_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1066
 *         size_t filterDesc, int dataType,
 *         int format, int k, int c, int h, int w):
 *     status = cudnnSetFilter4dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <FilterDescriptor>filterDesc, <DataType> dataType,
 *         <TensorFormat> format, k, c, h, w)
 */
  __pyx_v_status = cudnnSetFilter4dDescriptor_v4(((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnDataType_t)__pyx_v_dataType), ((cudnnTensorFormat_t)__pyx_v_format), __pyx_v_k, __pyx_v_c, __pyx_v_h, __pyx_v_w);

  /* "cupy/cuda/cudnn.pyx":1069
 *         <FilterDescriptor>filterDesc, <DataType> dataType,
 *         <TensorFormat> format, k, c, h, w)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1063
 * 
 * 
 * cpdef setFilter4dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t filterDesc, int dataType,
 *         int format, int k, int c, int h, int w):
 */

  /* 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.cuda.cudnn.setFilter4dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_61setFilter4dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_60setFilter4dDescriptor_v4[] = "setFilter4dDescriptor_v4(size_t filterDesc, int dataType, int format, int k, int c, int h, int w)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_61setFilter4dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_filterDesc;
  int __pyx_v_dataType;
  int __pyx_v_format;
  int __pyx_v_k;
  int __pyx_v_c;
  int __pyx_v_h;
  int __pyx_v_w;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFilter4dDescriptor_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filterDesc,&__pyx_n_s_dataType,&__pyx_n_s_format,&__pyx_n_s_k,&__pyx_n_s_c,&__pyx_n_s_h,&__pyx_n_s_w,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 1); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 2); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 3); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 4); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 5); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, 6); __PYX_ERR(0, 1063, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFilter4dDescriptor_v4") < 0)) __PYX_ERR(0, 1063, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1064, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1064, __pyx_L3_error)
    __pyx_v_format = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_format == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error)
    __pyx_v_k = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error)
    __pyx_v_c = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFilter4dDescriptor_v4", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1063, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setFilter4dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_60setFilter4dDescriptor_v4(__pyx_self, __pyx_v_filterDesc, __pyx_v_dataType, __pyx_v_format, __pyx_v_k, __pyx_v_c, __pyx_v_h, __pyx_v_w);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_60setFilter4dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_k, int __pyx_v_c, int __pyx_v_h, int __pyx_v_w) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFilter4dDescriptor_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setFilter4dDescriptor_v4(__pyx_v_filterDesc, __pyx_v_dataType, __pyx_v_format, __pyx_v_k, __pyx_v_c, __pyx_v_h, __pyx_v_w, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __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.cuda.cudnn.setFilter4dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1072
 * 
 * 
 * cpdef setFilterNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t filterDesc, int dataType,
 *         int format, int nbDims, size_t filterDimA):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_63setFilterNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFilterNdDescriptor_v4(size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_nbDims, size_t __pyx_v_filterDimA, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFilterNdDescriptor_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1075
 *         size_t filterDesc, int dataType,
 *         int format, int nbDims, size_t filterDimA):
 *     status = cudnnSetFilterNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <FilterDescriptor>filterDesc, <DataType>dataType,
 *         <TensorFormat>format, nbDims, <int*>filterDimA)
 */
  __pyx_v_status = cudnnSetFilterNdDescriptor_v4(((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnDataType_t)__pyx_v_dataType), ((cudnnTensorFormat_t)__pyx_v_format), __pyx_v_nbDims, ((int *)__pyx_v_filterDimA));

  /* "cupy/cuda/cudnn.pyx":1078
 *         <FilterDescriptor>filterDesc, <DataType>dataType,
 *         <TensorFormat>format, nbDims, <int*>filterDimA)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1072
 * 
 * 
 * cpdef setFilterNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t filterDesc, int dataType,
 *         int format, int nbDims, size_t filterDimA):
 */

  /* 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.cuda.cudnn.setFilterNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_63setFilterNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_62setFilterNdDescriptor_v4[] = "setFilterNdDescriptor_v4(size_t filterDesc, int dataType, int format, int nbDims, size_t filterDimA)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_63setFilterNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_filterDesc;
  int __pyx_v_dataType;
  int __pyx_v_format;
  int __pyx_v_nbDims;
  size_t __pyx_v_filterDimA;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFilterNdDescriptor_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filterDesc,&__pyx_n_s_dataType,&__pyx_n_s_format,&__pyx_n_s_nbDims,&__pyx_n_s_filterDimA,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilterNdDescriptor_v4", 1, 5, 5, 1); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilterNdDescriptor_v4", 1, 5, 5, 2); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbDims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilterNdDescriptor_v4", 1, 5, 5, 3); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDimA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFilterNdDescriptor_v4", 1, 5, 5, 4); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFilterNdDescriptor_v4") < 0)) __PYX_ERR(0, 1072, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L3_error)
    __pyx_v_format = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_format == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1074, __pyx_L3_error)
    __pyx_v_nbDims = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nbDims == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1074, __pyx_L3_error)
    __pyx_v_filterDimA = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_filterDimA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1074, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFilterNdDescriptor_v4", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1072, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setFilterNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_62setFilterNdDescriptor_v4(__pyx_self, __pyx_v_filterDesc, __pyx_v_dataType, __pyx_v_format, __pyx_v_nbDims, __pyx_v_filterDimA);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_62setFilterNdDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc, int __pyx_v_dataType, int __pyx_v_format, int __pyx_v_nbDims, size_t __pyx_v_filterDimA) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFilterNdDescriptor_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setFilterNdDescriptor_v4(__pyx_v_filterDesc, __pyx_v_dataType, __pyx_v_format, __pyx_v_nbDims, __pyx_v_filterDimA, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1072, __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.cuda.cudnn.setFilterNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1081
 * 
 * 
 * cpdef getFilterNdDescriptor(size_t wDesc, int nbDimsRequested):             # <<<<<<<<<<<<<<
 *     cdef DataType dataType
 *     cdef TensorFormat format
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_65getFilterNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFilterNdDescriptor(size_t __pyx_v_wDesc, int __pyx_v_nbDimsRequested, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnDataType_t __pyx_v_dataType;
  cudnnTensorFormat_t __pyx_v_format;
  int __pyx_v_nbDims;
  std::vector<int>  __pyx_v_filterDimA;
  int __pyx_v_status;
  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;
  __Pyx_RefNannySetupContext("getFilterNdDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1086
 *     cdef int nbDims
 *     cdef vector.vector[int] filterDimA
 *     filterDimA.resize(nbDimsRequested)             # <<<<<<<<<<<<<<
 * 
 *     status = cudnnGetFilterNdDescriptor_v4(
 */
  try {
    __pyx_v_filterDimA.resize(__pyx_v_nbDimsRequested);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1086, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1088
 *     filterDimA.resize(nbDimsRequested)
 * 
 *     status = cudnnGetFilterNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <FilterDescriptor>wDesc, nbDimsRequested, &dataType,
 *         &format, &nbDims, &filterDimA[0])
 */
  __pyx_v_status = cudnnGetFilterNdDescriptor_v4(((cudnnFilterDescriptor_t)__pyx_v_wDesc), __pyx_v_nbDimsRequested, (&__pyx_v_dataType), (&__pyx_v_format), (&__pyx_v_nbDims), (&(__pyx_v_filterDimA[0])));

  /* "cupy/cuda/cudnn.pyx":1091
 *         <FilterDescriptor>wDesc, nbDimsRequested, &dataType,
 *         &format, &nbDims, &filterDimA[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return dataType, format, nbDims, tuple(filterDimA)
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1092
 *         &format, &nbDims, &filterDimA[0])
 *     check_status(status)
 *     return dataType, format, nbDims, tuple(filterDimA)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnDataType_t(__pyx_v_dataType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_cudnnTensorFormat_t(__pyx_v_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nbDims); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert_vector_to_py_int(__pyx_v_filterDimA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1081
 * 
 * 
 * cpdef getFilterNdDescriptor(size_t wDesc, int nbDimsRequested):             # <<<<<<<<<<<<<<
 *     cdef DataType dataType
 *     cdef TensorFormat format
 */

  /* 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.cuda.cudnn.getFilterNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_65getFilterNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_64getFilterNdDescriptor[] = "getFilterNdDescriptor(size_t wDesc, int nbDimsRequested)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_65getFilterNdDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_wDesc;
  int __pyx_v_nbDimsRequested;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFilterNdDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wDesc,&__pyx_n_s_nbDimsRequested,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbDimsRequested)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFilterNdDescriptor", 1, 2, 2, 1); __PYX_ERR(0, 1081, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFilterNdDescriptor") < 0)) __PYX_ERR(0, 1081, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1081, __pyx_L3_error)
    __pyx_v_nbDimsRequested = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nbDimsRequested == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1081, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFilterNdDescriptor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1081, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getFilterNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_64getFilterNdDescriptor(__pyx_self, __pyx_v_wDesc, __pyx_v_nbDimsRequested);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_64getFilterNdDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_wDesc, int __pyx_v_nbDimsRequested) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFilterNdDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getFilterNdDescriptor(__pyx_v_wDesc, __pyx_v_nbDimsRequested, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __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.cuda.cudnn.getFilterNdDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1095
 * 
 * 
 * cpdef destroyFilterDescriptor(size_t filterDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyFilterDescriptor(<FilterDescriptor>filterDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_67destroyFilterDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_filterDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFilterDescriptor(size_t __pyx_v_filterDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFilterDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1096
 * 
 * cpdef destroyFilterDescriptor(size_t filterDesc):
 *     status = cudnnDestroyFilterDescriptor(<FilterDescriptor>filterDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyFilterDescriptor(((cudnnFilterDescriptor_t)__pyx_v_filterDesc));

  /* "cupy/cuda/cudnn.pyx":1097
 * cpdef destroyFilterDescriptor(size_t filterDesc):
 *     status = cudnnDestroyFilterDescriptor(<FilterDescriptor>filterDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1095
 * 
 * 
 * cpdef destroyFilterDescriptor(size_t filterDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyFilterDescriptor(<FilterDescriptor>filterDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyFilterDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_67destroyFilterDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_filterDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_66destroyFilterDescriptor[] = "destroyFilterDescriptor(size_t filterDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_67destroyFilterDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_filterDesc) {
  size_t __pyx_v_filterDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyFilterDescriptor (wrapper)", 0);
  assert(__pyx_arg_filterDesc); {
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(__pyx_arg_filterDesc); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1095, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyFilterDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_66destroyFilterDescriptor(__pyx_self, ((size_t)__pyx_v_filterDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_66destroyFilterDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_filterDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFilterDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyFilterDescriptor(__pyx_v_filterDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __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.cuda.cudnn.destroyFilterDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1104
 * ###############################################################################
 * 
 * cpdef size_t createConvolutionDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ConvolutionDescriptor desc
 *     status = cudnnCreateConvolutionDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_69createConvolutionDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createConvolutionDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnConvolutionDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createConvolutionDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1106
 * cpdef size_t createConvolutionDescriptor() except? 0:
 *     cdef ConvolutionDescriptor desc
 *     status = cudnnCreateConvolutionDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateConvolutionDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":1107
 *     cdef ConvolutionDescriptor desc
 *     status = cudnnCreateConvolutionDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1108
 *     status = cudnnCreateConvolutionDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1104
 * ###############################################################################
 * 
 * cpdef size_t createConvolutionDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ConvolutionDescriptor desc
 *     status = cudnnCreateConvolutionDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_69createConvolutionDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_68createConvolutionDescriptor[] = "createConvolutionDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_69createConvolutionDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createConvolutionDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_68createConvolutionDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_68createConvolutionDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createConvolutionDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createConvolutionDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1104, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1111
 * 
 * 
 * cpdef setConvolutionMathType(size_t convDesc, size_t mathType):             # <<<<<<<<<<<<<<
 *     status = cudnnSetConvolutionMathType(
 *         <ConvolutionDescriptor>convDesc, <MathType>mathType)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_71setConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionMathType(size_t __pyx_v_convDesc, size_t __pyx_v_mathType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionMathType", 0);

  /* "cupy/cuda/cudnn.pyx":1112
 * 
 * cpdef setConvolutionMathType(size_t convDesc, size_t mathType):
 *     status = cudnnSetConvolutionMathType(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, <MathType>mathType)
 *     check_status(status)
 */
  __pyx_v_status = cudnnSetConvolutionMathType(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnMathType_t)__pyx_v_mathType));

  /* "cupy/cuda/cudnn.pyx":1114
 *     status = cudnnSetConvolutionMathType(
 *         <ConvolutionDescriptor>convDesc, <MathType>mathType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1111
 * 
 * 
 * cpdef setConvolutionMathType(size_t convDesc, size_t mathType):             # <<<<<<<<<<<<<<
 *     status = cudnnSetConvolutionMathType(
 *         <ConvolutionDescriptor>convDesc, <MathType>mathType)
 */

  /* 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.cuda.cudnn.setConvolutionMathType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_71setConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_70setConvolutionMathType[] = "setConvolutionMathType(size_t convDesc, size_t mathType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_71setConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_convDesc;
  size_t __pyx_v_mathType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvolutionMathType (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_convDesc,&__pyx_n_s_mathType,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mathType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionMathType", 1, 2, 2, 1); __PYX_ERR(0, 1111, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvolutionMathType") < 0)) __PYX_ERR(0, 1111, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error)
    __pyx_v_mathType = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_mathType == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvolutionMathType", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setConvolutionMathType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_70setConvolutionMathType(__pyx_self, __pyx_v_convDesc, __pyx_v_mathType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_70setConvolutionMathType(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, size_t __pyx_v_mathType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionMathType", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setConvolutionMathType(__pyx_v_convDesc, __pyx_v_mathType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __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.cuda.cudnn.setConvolutionMathType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1117
 * 
 * 
 * cpdef size_t getConvolutionMathType(size_t convDesc) except? 0:             # <<<<<<<<<<<<<<
 *     cdef MathType mathType
 *     status = cudnnGetConvolutionMathType(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_73getConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionMathType(size_t __pyx_v_convDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnMathType_t __pyx_v_mathType;
  CYTHON_UNUSED int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionMathType", 0);

  /* "cupy/cuda/cudnn.pyx":1119
 * cpdef size_t getConvolutionMathType(size_t convDesc) except? 0:
 *     cdef MathType mathType
 *     status = cudnnGetConvolutionMathType(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, &mathType)
 *     return <size_t>mathType
 */
  __pyx_v_status = cudnnGetConvolutionMathType(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), (&__pyx_v_mathType));

  /* "cupy/cuda/cudnn.pyx":1121
 *     status = cudnnGetConvolutionMathType(
 *         <ConvolutionDescriptor>convDesc, &mathType)
 *     return <size_t>mathType             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_mathType);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1117
 * 
 * 
 * cpdef size_t getConvolutionMathType(size_t convDesc) except? 0:             # <<<<<<<<<<<<<<
 *     cdef MathType mathType
 *     status = cudnnGetConvolutionMathType(
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_73getConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_72getConvolutionMathType[] = "getConvolutionMathType(size_t convDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_73getConvolutionMathType(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc) {
  size_t __pyx_v_convDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionMathType (wrapper)", 0);
  assert(__pyx_arg_convDesc); {
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(__pyx_arg_convDesc); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1117, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionMathType", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_72getConvolutionMathType(__pyx_self, ((size_t)__pyx_v_convDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_72getConvolutionMathType(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionMathType", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionMathType(__pyx_v_convDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1117, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1124
 * 
 * 
 * cpdef setConvolutionGroupCount(size_t convDesc, int groupCount):             # <<<<<<<<<<<<<<
 *     status = cudnnSetConvolutionGroupCount(
 *         <ConvolutionDescriptor>convDesc, groupCount)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_75setConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionGroupCount(size_t __pyx_v_convDesc, int __pyx_v_groupCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionGroupCount", 0);

  /* "cupy/cuda/cudnn.pyx":1125
 * 
 * cpdef setConvolutionGroupCount(size_t convDesc, int groupCount):
 *     status = cudnnSetConvolutionGroupCount(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, groupCount)
 *     check_status(status)
 */
  __pyx_v_status = cudnnSetConvolutionGroupCount(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), __pyx_v_groupCount);

  /* "cupy/cuda/cudnn.pyx":1127
 *     status = cudnnSetConvolutionGroupCount(
 *         <ConvolutionDescriptor>convDesc, groupCount)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1124
 * 
 * 
 * cpdef setConvolutionGroupCount(size_t convDesc, int groupCount):             # <<<<<<<<<<<<<<
 *     status = cudnnSetConvolutionGroupCount(
 *         <ConvolutionDescriptor>convDesc, groupCount)
 */

  /* 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.cuda.cudnn.setConvolutionGroupCount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_75setConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_74setConvolutionGroupCount[] = "setConvolutionGroupCount(size_t convDesc, int groupCount)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_75setConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_convDesc;
  int __pyx_v_groupCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvolutionGroupCount (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_convDesc,&__pyx_n_s_groupCount,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_groupCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionGroupCount", 1, 2, 2, 1); __PYX_ERR(0, 1124, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvolutionGroupCount") < 0)) __PYX_ERR(0, 1124, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1124, __pyx_L3_error)
    __pyx_v_groupCount = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_groupCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1124, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvolutionGroupCount", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1124, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setConvolutionGroupCount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_74setConvolutionGroupCount(__pyx_self, __pyx_v_convDesc, __pyx_v_groupCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_74setConvolutionGroupCount(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_groupCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionGroupCount", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setConvolutionGroupCount(__pyx_v_convDesc, __pyx_v_groupCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __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.cuda.cudnn.setConvolutionGroupCount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1130
 * 
 * 
 * cpdef int getConvolutionGroupCount(size_t convDesc) except? -1:             # <<<<<<<<<<<<<<
 *     cdef int groupCount
 *     status = cudnnGetConvolutionGroupCount(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_77getConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionGroupCount(size_t __pyx_v_convDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_groupCount;
  CYTHON_UNUSED int __pyx_v_status;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionGroupCount", 0);

  /* "cupy/cuda/cudnn.pyx":1132
 * cpdef int getConvolutionGroupCount(size_t convDesc) except? -1:
 *     cdef int groupCount
 *     status = cudnnGetConvolutionGroupCount(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, &groupCount)
 *     return groupCount
 */
  __pyx_v_status = cudnnGetConvolutionGroupCount(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), (&__pyx_v_groupCount));

  /* "cupy/cuda/cudnn.pyx":1134
 *     status = cudnnGetConvolutionGroupCount(
 *         <ConvolutionDescriptor>convDesc, &groupCount)
 *     return groupCount             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_groupCount;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1130
 * 
 * 
 * cpdef int getConvolutionGroupCount(size_t convDesc) except? -1:             # <<<<<<<<<<<<<<
 *     cdef int groupCount
 *     status = cudnnGetConvolutionGroupCount(
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_77getConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_76getConvolutionGroupCount[] = "getConvolutionGroupCount(size_t convDesc) -> int";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_77getConvolutionGroupCount(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc) {
  size_t __pyx_v_convDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionGroupCount (wrapper)", 0);
  assert(__pyx_arg_convDesc); {
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(__pyx_arg_convDesc); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionGroupCount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_76getConvolutionGroupCount(__pyx_self, ((size_t)__pyx_v_convDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_76getConvolutionGroupCount(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionGroupCount", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionGroupCount(__pyx_v_convDesc, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1137
 * 
 * 
 * cpdef setConvolution2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_79setConvolution2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v4(size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1140
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode):
 *     status = cudnnSetConvolution2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, pad_h, pad_w, u, v, dilation_h,
 *         dilation_w, <ConvolutionMode>mode)
 */
  __pyx_v_status = cudnnSetConvolution2dDescriptor_v4(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, ((cudnnConvolutionMode_t)__pyx_v_mode));

  /* "cupy/cuda/cudnn.pyx":1143
 *         <ConvolutionDescriptor>convDesc, pad_h, pad_w, u, v, dilation_h,
 *         dilation_w, <ConvolutionMode>mode)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1137
 * 
 * 
 * cpdef setConvolution2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode):
 */

  /* 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.cuda.cudnn.setConvolution2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_79setConvolution2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_78setConvolution2dDescriptor_v4[] = "setConvolution2dDescriptor_v4(size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h, int dilation_w, int mode)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_79setConvolution2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_convDesc;
  int __pyx_v_pad_h;
  int __pyx_v_pad_w;
  int __pyx_v_u;
  int __pyx_v_v;
  int __pyx_v_dilation_h;
  int __pyx_v_dilation_w;
  int __pyx_v_mode;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_convDesc,&__pyx_n_s_pad_h,&__pyx_n_s_pad_w,&__pyx_n_s_u,&__pyx_n_s_v,&__pyx_n_s_dilation_h,&__pyx_n_s_dilation_w,&__pyx_n_s_mode,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pad_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 1); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pad_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 2); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 3); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 4); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 5); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 6); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, 7); __PYX_ERR(0, 1137, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvolution2dDescriptor_v4") < 0)) __PYX_ERR(0, 1137, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_pad_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pad_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_pad_w = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pad_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_u = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_v = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_dilation_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_dilation_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1138, __pyx_L3_error)
    __pyx_v_dilation_w = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_dilation_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1139, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1139, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v4", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setConvolution2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_78setConvolution2dDescriptor_v4(__pyx_self, __pyx_v_convDesc, __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, __pyx_v_mode);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_78setConvolution2dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v4(__pyx_v_convDesc, __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, __pyx_v_mode, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __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.cuda.cudnn.setConvolution2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1146
 * 
 * 
 * cpdef setConvolution2dDescriptor_v5(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode, size_t computeType):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_81setConvolution2dDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v5(size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode, size_t __pyx_v_computeType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v5", 0);

  /* "cupy/cuda/cudnn.pyx":1149
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode, size_t computeType):
 *     status = cudnnSetConvolution2dDescriptor_v5(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, pad_h, pad_w, u, v, dilation_h,
 *         dilation_w, <ConvolutionMode>mode, <DataType>computeType)
 */
  __pyx_v_status = cudnnSetConvolution2dDescriptor_v5(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, ((cudnnConvolutionMode_t)__pyx_v_mode), ((cudnnDataType_t)__pyx_v_computeType));

  /* "cupy/cuda/cudnn.pyx":1152
 *         <ConvolutionDescriptor>convDesc, pad_h, pad_w, u, v, dilation_h,
 *         dilation_w, <ConvolutionMode>mode, <DataType>computeType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1146
 * 
 * 
 * cpdef setConvolution2dDescriptor_v5(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h,
 *         int dilation_w, int mode, size_t computeType):
 */

  /* 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.cuda.cudnn.setConvolution2dDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_81setConvolution2dDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_80setConvolution2dDescriptor_v5[] = "setConvolution2dDescriptor_v5(size_t convDesc, int pad_h, int pad_w, int u, int v, int dilation_h, int dilation_w, int mode, size_t computeType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_81setConvolution2dDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_convDesc;
  int __pyx_v_pad_h;
  int __pyx_v_pad_w;
  int __pyx_v_u;
  int __pyx_v_v;
  int __pyx_v_dilation_h;
  int __pyx_v_dilation_w;
  int __pyx_v_mode;
  size_t __pyx_v_computeType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v5 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_convDesc,&__pyx_n_s_pad_h,&__pyx_n_s_pad_w,&__pyx_n_s_u,&__pyx_n_s_v,&__pyx_n_s_dilation_h,&__pyx_n_s_dilation_w,&__pyx_n_s_mode,&__pyx_n_s_computeType,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pad_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 1); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pad_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 2); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 3); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 4); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 5); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 6); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 7); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_computeType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, 8); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvolution2dDescriptor_v5") < 0)) __PYX_ERR(0, 1146, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_pad_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pad_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_pad_w = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pad_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_u = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_v = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_dilation_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_dilation_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L3_error)
    __pyx_v_dilation_w = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_dilation_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1148, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1148, __pyx_L3_error)
    __pyx_v_computeType = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_computeType == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1148, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvolution2dDescriptor_v5", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1146, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setConvolution2dDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_80setConvolution2dDescriptor_v5(__pyx_self, __pyx_v_convDesc, __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, __pyx_v_mode, __pyx_v_computeType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_80setConvolution2dDescriptor_v5(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_pad_h, int __pyx_v_pad_w, int __pyx_v_u, int __pyx_v_v, int __pyx_v_dilation_h, int __pyx_v_dilation_w, int __pyx_v_mode, size_t __pyx_v_computeType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolution2dDescriptor_v5", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v5(__pyx_v_convDesc, __pyx_v_pad_h, __pyx_v_pad_w, __pyx_v_u, __pyx_v_v, __pyx_v_dilation_h, __pyx_v_dilation_w, __pyx_v_mode, __pyx_v_computeType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __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.cuda.cudnn.setConvolution2dDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1155
 * 
 * 
 * cpdef setConvolutionNdDescriptor_v3(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int arrayLength, size_t padA, size_t filterStrideA,
 *         size_t dilationA, int mode, int dataType):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_83setConvolutionNdDescriptor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setConvolutionNdDescriptor_v3(size_t __pyx_v_convDesc, int __pyx_v_arrayLength, size_t __pyx_v_padA, size_t __pyx_v_filterStrideA, size_t __pyx_v_dilationA, int __pyx_v_mode, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionNdDescriptor_v3", 0);

  /* "cupy/cuda/cudnn.pyx":1158
 *         size_t convDesc, int arrayLength, size_t padA, size_t filterStrideA,
 *         size_t dilationA, int mode, int dataType):
 *     status = cudnnSetConvolutionNdDescriptor_v3(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc, arrayLength, <int*>padA,
 *         <int*>filterStrideA, <int*>dilationA, <ConvolutionMode>mode,
 */
  __pyx_v_status = cudnnSetConvolutionNdDescriptor_v3(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), __pyx_v_arrayLength, ((int *)__pyx_v_padA), ((int *)__pyx_v_filterStrideA), ((int *)__pyx_v_dilationA), ((cudnnConvolutionMode_t)__pyx_v_mode), ((cudnnDataType_t)__pyx_v_dataType));

  /* "cupy/cuda/cudnn.pyx":1162
 *         <int*>filterStrideA, <int*>dilationA, <ConvolutionMode>mode,
 *         <DataType>dataType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1155
 * 
 * 
 * cpdef setConvolutionNdDescriptor_v3(             # <<<<<<<<<<<<<<
 *         size_t convDesc, int arrayLength, size_t padA, size_t filterStrideA,
 *         size_t dilationA, int mode, int dataType):
 */

  /* 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.cuda.cudnn.setConvolutionNdDescriptor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_83setConvolutionNdDescriptor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_82setConvolutionNdDescriptor_v3[] = "setConvolutionNdDescriptor_v3(size_t convDesc, int arrayLength, size_t padA, size_t filterStrideA, size_t dilationA, int mode, int dataType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_83setConvolutionNdDescriptor_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_convDesc;
  int __pyx_v_arrayLength;
  size_t __pyx_v_padA;
  size_t __pyx_v_filterStrideA;
  size_t __pyx_v_dilationA;
  int __pyx_v_mode;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setConvolutionNdDescriptor_v3 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_convDesc,&__pyx_n_s_arrayLength,&__pyx_n_s_padA,&__pyx_n_s_filterStrideA,&__pyx_n_s_dilationA,&__pyx_n_s_mode,&__pyx_n_s_dataType,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arrayLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 1); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_padA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 2); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterStrideA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 3); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilationA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 4); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 5); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, 6); __PYX_ERR(0, 1155, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setConvolutionNdDescriptor_v3") < 0)) __PYX_ERR(0, 1155, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
    __pyx_v_arrayLength = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_arrayLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
    __pyx_v_padA = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_padA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
    __pyx_v_filterStrideA = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_filterStrideA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
    __pyx_v_dilationA = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dilationA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setConvolutionNdDescriptor_v3", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setConvolutionNdDescriptor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_82setConvolutionNdDescriptor_v3(__pyx_self, __pyx_v_convDesc, __pyx_v_arrayLength, __pyx_v_padA, __pyx_v_filterStrideA, __pyx_v_dilationA, __pyx_v_mode, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_82setConvolutionNdDescriptor_v3(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc, int __pyx_v_arrayLength, size_t __pyx_v_padA, size_t __pyx_v_filterStrideA, size_t __pyx_v_dilationA, int __pyx_v_mode, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setConvolutionNdDescriptor_v3", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setConvolutionNdDescriptor_v3(__pyx_v_convDesc, __pyx_v_arrayLength, __pyx_v_padA, __pyx_v_filterStrideA, __pyx_v_dilationA, __pyx_v_mode, __pyx_v_dataType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1155, __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.cuda.cudnn.setConvolutionNdDescriptor_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1165
 * 
 * 
 * cpdef destroyConvolutionDescriptor(size_t convDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyConvolutionDescriptor(
 *         <ConvolutionDescriptor>convDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_85destroyConvolutionDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyConvolutionDescriptor(size_t __pyx_v_convDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyConvolutionDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1166
 * 
 * cpdef destroyConvolutionDescriptor(size_t convDesc):
 *     status = cudnnDestroyConvolutionDescriptor(             # <<<<<<<<<<<<<<
 *         <ConvolutionDescriptor>convDesc)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDestroyConvolutionDescriptor(((cudnnConvolutionDescriptor_t)__pyx_v_convDesc));

  /* "cupy/cuda/cudnn.pyx":1168
 *     status = cudnnDestroyConvolutionDescriptor(
 *         <ConvolutionDescriptor>convDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1165
 * 
 * 
 * cpdef destroyConvolutionDescriptor(size_t convDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyConvolutionDescriptor(
 *         <ConvolutionDescriptor>convDesc)
 */

  /* 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.cuda.cudnn.destroyConvolutionDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_85destroyConvolutionDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_84destroyConvolutionDescriptor[] = "destroyConvolutionDescriptor(size_t convDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_85destroyConvolutionDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_convDesc) {
  size_t __pyx_v_convDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyConvolutionDescriptor (wrapper)", 0);
  assert(__pyx_arg_convDesc); {
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(__pyx_arg_convDesc); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyConvolutionDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_84destroyConvolutionDescriptor(__pyx_self, ((size_t)__pyx_v_convDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_84destroyConvolutionDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_convDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyConvolutionDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyConvolutionDescriptor(__pyx_v_convDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __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.cuda.cudnn.destroyConvolutionDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1171
 * 
 * 
 * cpdef findConvolutionForwardAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t wDesc, size_t convDesc,
 *         size_t yDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_87findConvolutionForwardAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithm(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionFwdAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithm", 0);

  /* "cupy/cuda/cudnn.pyx":1176
 *     cdef vector.vector[ConvolutionFwdAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionForwardAlgorithm(
 *         <Handle> handle, <TensorDescriptor>xDesc, <FilterDescriptor>wDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1176, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1177
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionForwardAlgorithm(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <FilterDescriptor>wDesc,
 *         <ConvolutionDescriptor>convDesc, <TensorDescriptor>yDesc,
 */
  __pyx_v_status = cudnnFindConvolutionForwardAlgorithm(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1181
 *         <ConvolutionDescriptor>convDesc, <TensorDescriptor>yDesc,
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1182
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return perfResults
 * 
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1182, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1183
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t(__pyx_v_perfResults); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1171
 * 
 * 
 * cpdef findConvolutionForwardAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t wDesc, size_t convDesc,
 *         size_t yDesc, int requestedAlgoCount):
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_87findConvolutionForwardAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_86findConvolutionForwardAlgorithm[] = "findConvolutionForwardAlgorithm(intptr_t handle, size_t xDesc, size_t wDesc, size_t convDesc, size_t yDesc, int requestedAlgoCount)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_87findConvolutionForwardAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_yDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_wDesc,&__pyx_n_s_convDesc,&__pyx_n_s_yDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, 1); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, 2); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, 3); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, 4); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, 5); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionForwardAlgorithm") < 0)) __PYX_ERR(0, 1171, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1172, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1172, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1172, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1172, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithm", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionForwardAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_86findConvolutionForwardAlgorithm(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_86findConvolutionForwardAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithm", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithm(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_requestedAlgoCount, 0); 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.cuda.cudnn.findConvolutionForwardAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1186
 * 
 * 
 * cpdef list findConvolutionForwardAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w,
 *         size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_89findConvolutionForwardAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionFwdAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionFwdAlgoPerf_t __pyx_8genexpr1__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionFwdAlgoPerf_t> ::iterator __pyx_t_2;
  cudnnConvolutionFwdAlgoPerf_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 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx", 0);

  /* "cupy/cuda/cudnn.pyx":1192
 *     cdef vector.vector[ConvolutionFwdAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionForwardAlgorithmEx(
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1192, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1193
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionForwardAlgorithmEx(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 *         <FilterDescriptor>wDesc, <void*>w, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionForwardAlgorithmEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1199
 *         &returnedAlgoCount, &perfResults[0], <void*>workSpace,
 *         workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1200
 *         workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1200, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1201
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1202
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr1__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1201
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr1__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr1__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr1__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr1__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_int_neg_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cupy/cuda/cudnn.pyx":1202
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1186
 * 
 * 
 * cpdef list findConvolutionForwardAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w,
 *         size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount,
 */

  /* 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.cuda.cudnn.findConvolutionForwardAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_89findConvolutionForwardAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_88findConvolutionForwardAlgorithmEx[] = "findConvolutionForwardAlgorithmEx(intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w, size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_89findConvolutionForwardAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_convDesc,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 1); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 2); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 3); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 4); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 5); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 6); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 7); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 8); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 9); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, 10); __PYX_ERR(0, 1186, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionForwardAlgorithmEx") < 0)) __PYX_ERR(0, 1186, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1188, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1188, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1188, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1188, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1189, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1189, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1186, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionForwardAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_88findConvolutionForwardAlgorithmEx(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_wDesc, __pyx_v_w, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_88findConvolutionForwardAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_wDesc, __pyx_v_w, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __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.cuda.cudnn.findConvolutionForwardAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1205
 * 
 * 
 * cpdef list findConvolutionForwardAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w,
 *         size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_91findConvolutionForwardAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx_v7(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionFwdAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionFwdAlgoPerf_v7_t __pyx_8genexpr2__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionFwdAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionFwdAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1211
 *     cdef vector.vector[ConvolutionFwdAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionForwardAlgorithmEx_v7(
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1211, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1212
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionForwardAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 *         <FilterDescriptor>wDesc, <void*>w, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionForwardAlgorithmEx_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1218
 *         &returnedAlgoCount, &perfResults[0], <void*>workSpace,
 *         workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1219
 *         workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1219, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1220
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1222
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr2__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1220
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr2__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr2__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr2__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr2__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1221
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr2__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr2__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1220
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1220, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1222
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1205
 * 
 * 
 * cpdef list findConvolutionForwardAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w,
 *         size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount,
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionForwardAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_91findConvolutionForwardAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_90findConvolutionForwardAlgorithmEx_v7[] = "findConvolutionForwardAlgorithmEx_v7(intptr_t handle, size_t xDesc, size_t x, size_t wDesc, size_t w, size_t convDesc, size_t yDesc, size_t y, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_91findConvolutionForwardAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_convDesc,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 1); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 2); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 3); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 4); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 5); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 6); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 7); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 8); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 9); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, 10); __PYX_ERR(0, 1205, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionForwardAlgorithmEx_v7") < 0)) __PYX_ERR(0, 1205, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1207, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1208, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1208, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionForwardAlgorithmEx_v7", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1205, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionForwardAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_90findConvolutionForwardAlgorithmEx_v7(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_wDesc, __pyx_v_w, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_90findConvolutionForwardAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_convDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionForwardAlgorithmEx_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx_v7(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_wDesc, __pyx_v_w, __pyx_v_convDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __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.cuda.cudnn.findConvolutionForwardAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1225
 * 
 * 
 * cpdef int getConvolutionForwardAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int preference, size_t memoryLimitInbytes) except? -1:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_93getConvolutionForwardAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v6(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnConvolutionFwdAlgo_t __pyx_v_algo;
  int __pyx_v_status;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v6", 0);

  /* "cupy/cuda/cudnn.pyx":1229
 *         size_t destDesc, int preference, size_t memoryLimitInbytes) except? -1:
 *     cdef ConvolutionFwdAlgo algo
 *     status = cudnnGetConvolutionForwardAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>srcDesc,
 *         <FilterDescriptor>filterDesc, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionForwardAlgorithm_v6(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((cudnnConvolutionFwdPreference_t)__pyx_v_preference), __pyx_v_memoryLimitInbytes, (&__pyx_v_algo));

  /* "cupy/cuda/cudnn.pyx":1234
 *         <TensorDescriptor>destDesc, <ConvolutionFwdPreference>preference,
 *         memoryLimitInbytes, &algo)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return algo
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1235
 *         memoryLimitInbytes, &algo)
 *     check_status(status)
 *     return algo             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_algo;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1225
 * 
 * 
 * cpdef int getConvolutionForwardAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int preference, size_t memoryLimitInbytes) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_93getConvolutionForwardAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_92getConvolutionForwardAlgorithm_v6[] = "getConvolutionForwardAlgorithm_v6(intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc, size_t destDesc, int preference, size_t memoryLimitInbytes) -> int";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_93getConvolutionForwardAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_destDesc;
  int __pyx_v_preference;
  size_t __pyx_v_memoryLimitInbytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v6 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_filterDesc,&__pyx_n_s_convDesc,&__pyx_n_s_destDesc,&__pyx_n_s_preference,&__pyx_n_s_memoryLimitInbytes,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 1); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 2); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 3); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 4); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_preference)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 5); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_memoryLimitInbytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, 6); __PYX_ERR(0, 1225, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionForwardAlgorithm_v6") < 0)) __PYX_ERR(0, 1225, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1227, __pyx_L3_error)
    __pyx_v_preference = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_preference == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1227, __pyx_L3_error)
    __pyx_v_memoryLimitInbytes = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_memoryLimitInbytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1227, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v6", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_92getConvolutionForwardAlgorithm_v6(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_92getConvolutionForwardAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v6", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v6(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1225, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1238
 * 
 * 
 * cpdef list getConvolutionForwardAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_95getConvolutionForwardAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v7(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionFwdAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionFwdAlgoPerf_v7_t __pyx_8genexpr3__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionFwdAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionFwdAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1243
 *     cdef vector.vector[ConvolutionFwdAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnGetConvolutionForwardAlgorithm_v7(
 *         <Handle> handle, <TensorDescriptor>srcDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1243, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1244
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnGetConvolutionForwardAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>srcDesc,
 *         <FilterDescriptor>filterDesc, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionForwardAlgorithm_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1249
 *         <TensorDescriptor>destDesc, requestedAlgoCount,
 *         &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1250
 *         &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1250, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1251
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1253
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr3__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1251
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr3__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr3__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr3__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr3__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1252
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr3__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr3__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1251
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1253
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1238
 * 
 * 
 * cpdef list getConvolutionForwardAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int requestedAlgoCount):
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_95getConvolutionForwardAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_94getConvolutionForwardAlgorithm_v7[] = "getConvolutionForwardAlgorithm_v7(intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc, size_t destDesc, int requestedAlgoCount) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_95getConvolutionForwardAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_destDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_filterDesc,&__pyx_n_s_convDesc,&__pyx_n_s_destDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, 1); __PYX_ERR(0, 1238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, 2); __PYX_ERR(0, 1238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, 3); __PYX_ERR(0, 1238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, 4); __PYX_ERR(0, 1238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, 5); __PYX_ERR(0, 1238, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionForwardAlgorithm_v7") < 0)) __PYX_ERR(0, 1238, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionForwardAlgorithm_v7", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_94getConvolutionForwardAlgorithm_v7(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_94getConvolutionForwardAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardAlgorithm_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v7(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_requestedAlgoCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __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.cuda.cudnn.getConvolutionForwardAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1256
 * 
 * 
 * cpdef Py_ssize_t getConvolutionForwardWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int algo) except? -1:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_97getConvolutionForwardWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_algo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1260
 *         size_t destDesc, int algo) except? -1:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetConvolutionForwardWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>srcDesc,
 *         <FilterDescriptor>filterDesc, <ConvolutionDescriptor> convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionForwardWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((cudnnConvolutionFwdAlgo_t)__pyx_v_algo), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1264
 *         <FilterDescriptor>filterDesc, <ConvolutionDescriptor> convDesc,
 *         <TensorDescriptor>destDesc, <ConvolutionFwdAlgo>algo, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <Py_ssize_t>sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1265
 *         <TensorDescriptor>destDesc, <ConvolutionFwdAlgo>algo, &sizeInBytes)
 *     check_status(status)
 *     return <Py_ssize_t>sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((Py_ssize_t)__pyx_v_sizeInBytes);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1256
 * 
 * 
 * cpdef Py_ssize_t getConvolutionForwardWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc,
 *         size_t destDesc, int algo) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_97getConvolutionForwardWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_96getConvolutionForwardWorkspaceSize[] = "getConvolutionForwardWorkspaceSize(intptr_t handle, size_t srcDesc, size_t filterDesc, size_t convDesc, size_t destDesc, int algo) -> Py_ssize_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_97getConvolutionForwardWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_destDesc;
  int __pyx_v_algo;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionForwardWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_filterDesc,&__pyx_n_s_convDesc,&__pyx_n_s_destDesc,&__pyx_n_s_algo,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, 1); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, 2); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, 3); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, 4); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, 5); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionForwardWorkspaceSize") < 0)) __PYX_ERR(0, 1256, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1257, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1257, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1257, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1257, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1258, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1258, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionForwardWorkspaceSize", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionForwardWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_96getConvolutionForwardWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_algo);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_96getConvolutionForwardWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_filterDesc, size_t __pyx_v_convDesc, size_t __pyx_v_destDesc, int __pyx_v_algo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionForwardWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardWorkspaceSize(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_filterDesc, __pyx_v_convDesc, __pyx_v_destDesc, __pyx_v_algo, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L) && PyErr_Occurred())) __PYX_ERR(0, 1256, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1268
 * 
 * 
 * cpdef convolutionForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t filterDesc, size_t filterData, size_t convDesc, int algo,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_99convolutionForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionForward(intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionForward", 0);

  /* "cupy/cuda/cudnn.pyx":1273
 *         size_t workSpace, size_t workSpaceSizeInBytes, size_t beta,
 *         size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnConvolutionForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1274
 *         size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionForward(
 *             <Handle>handle, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1275
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnConvolutionForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnConvolutionForward(((cudnnHandle_t)__pyx_v_handle), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((void *)__pyx_v_filterData), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnConvolutionFwdAlgo_t)__pyx_v_algo), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((void *)__pyx_v_destData));
      }

      /* "cupy/cuda/cudnn.pyx":1274
 *         size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionForward(
 *             <Handle>handle, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1282
 *             <void*>workSpace, workSpaceSizeInBytes, <void*>beta,
 *             <TensorDescriptor>destDesc, <void*>destData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1268
 * 
 * 
 * cpdef convolutionForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t filterDesc, size_t filterData, size_t convDesc, int algo,
 */

  /* 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.cuda.cudnn.convolutionForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_99convolutionForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_98convolutionForward[] = "convolutionForward(intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData, size_t filterDesc, size_t filterData, size_t convDesc, int algo, size_t workSpace, size_t workSpaceSizeInBytes, size_t beta, size_t destDesc, size_t destData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_99convolutionForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_filterData;
  size_t __pyx_v_convDesc;
  int __pyx_v_algo;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_beta;
  size_t __pyx_v_destDesc;
  size_t __pyx_v_destData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convolutionForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_filterDesc,&__pyx_n_s_filterData,&__pyx_n_s_convDesc,&__pyx_n_s_algo,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_beta,&__pyx_n_s_destDesc,&__pyx_n_s_destData,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 1); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 2); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 3); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 4); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 5); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 6); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 7); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 8); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 9); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 10); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 11); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, 12); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolutionForward") < 0)) __PYX_ERR(0, 1268, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1269, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1269, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1269, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1269, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1270, __pyx_L3_error)
    __pyx_v_filterData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_filterData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1270, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1270, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1270, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1271, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1271, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1271, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1272, __pyx_L3_error)
    __pyx_v_destData = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_destData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1272, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convolutionForward", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1268, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.convolutionForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_98convolutionForward(__pyx_self, __pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_filterDesc, __pyx_v_filterData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_destDesc, __pyx_v_destData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_98convolutionForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_convolutionForward(__pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_filterDesc, __pyx_v_filterData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_destDesc, __pyx_v_destData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __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.cuda.cudnn.convolutionForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1285
 * 
 * 
 * cpdef convolutionBackwardBias(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t beta, size_t destDesc, size_t destData):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_101convolutionBackwardBias(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardBias(intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardBias", 0);

  /* "cupy/cuda/cudnn.pyx":1288
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t beta, size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnConvolutionBackwardBias(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1289
 *         size_t beta, size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardBias(
 *             <Handle>handle, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1290
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnConvolutionBackwardBias(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 */
        __pyx_v_status = cudnnConvolutionBackwardBias(((cudnnHandle_t)__pyx_v_handle), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((void *)__pyx_v_destData));
      }

      /* "cupy/cuda/cudnn.pyx":1289
 *         size_t beta, size_t destDesc, size_t destData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardBias(
 *             <Handle>handle, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1294
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 *             <TensorDescriptor>destDesc, <void*>destData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1285
 * 
 * 
 * cpdef convolutionBackwardBias(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t beta, size_t destDesc, size_t destData):
 */

  /* 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.cuda.cudnn.convolutionBackwardBias", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_101convolutionBackwardBias(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_100convolutionBackwardBias[] = "convolutionBackwardBias(intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData, size_t beta, size_t destDesc, size_t destData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_101convolutionBackwardBias(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_beta;
  size_t __pyx_v_destDesc;
  size_t __pyx_v_destData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convolutionBackwardBias (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_beta,&__pyx_n_s_destDesc,&__pyx_n_s_destData,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 1); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 2); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 3); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 4); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 5); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, 6); __PYX_ERR(0, 1285, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolutionBackwardBias") < 0)) __PYX_ERR(0, 1285, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L3_error)
    __pyx_v_destData = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_destData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convolutionBackwardBias", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.convolutionBackwardBias", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_100convolutionBackwardBias(__pyx_self, __pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_destDesc, __pyx_v_destData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_100convolutionBackwardBias(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_destDesc, size_t __pyx_v_destData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardBias", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardBias(__pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_destDesc, __pyx_v_destData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1285, __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.cuda.cudnn.convolutionBackwardBias", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1297
 * 
 * 
 * cpdef findConvolutionBackwardFilterAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t dyDesc, size_t convDesc,
 *         size_t dwDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_103findConvolutionBackwardFilterAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithm(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithm", 0);

  /* "cupy/cuda/cudnn.pyx":1302
 *     cdef vector.vector[ConvolutionBwdFilterAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardFilterAlgorithm(
 *         <Handle> handle, <TensorDescriptor>xDesc, <TensorDescriptor>dyDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1302, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1303
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardFilterAlgorithm(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <TensorDescriptor>dyDesc,
 *         <ConvolutionDescriptor>convDesc, <FilterDescriptor>dwDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardFilterAlgorithm(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_dwDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1307
 *         <ConvolutionDescriptor>convDesc, <FilterDescriptor>dwDesc,
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1308
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return perfResults
 * 
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1308, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1309
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t(__pyx_v_perfResults); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1297
 * 
 * 
 * cpdef findConvolutionBackwardFilterAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t dyDesc, size_t convDesc,
 *         size_t dwDesc, int requestedAlgoCount):
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_103findConvolutionBackwardFilterAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_102findConvolutionBackwardFilterAlgorithm[] = "findConvolutionBackwardFilterAlgorithm(intptr_t handle, size_t xDesc, size_t dyDesc, size_t convDesc, size_t dwDesc, int requestedAlgoCount)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_103findConvolutionBackwardFilterAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dwDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_dyDesc,&__pyx_n_s_convDesc,&__pyx_n_s_dwDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, 1); __PYX_ERR(0, 1297, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, 2); __PYX_ERR(0, 1297, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, 3); __PYX_ERR(0, 1297, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dwDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, 4); __PYX_ERR(0, 1297, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, 5); __PYX_ERR(0, 1297, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardFilterAlgorithm") < 0)) __PYX_ERR(0, 1297, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1298, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1298, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1298, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1298, __pyx_L3_error)
    __pyx_v_dwDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dwDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithm", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1297, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardFilterAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_102findConvolutionBackwardFilterAlgorithm(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_dyDesc, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_102findConvolutionBackwardFilterAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithm", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithm(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_dyDesc, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_requestedAlgoCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __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.cuda.cudnn.findConvolutionBackwardFilterAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1312
 * 
 * 
 * cpdef list findConvolutionBackwardFilterAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_105findConvolutionBackwardFilterAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdFilterAlgoPerf_t __pyx_8genexpr4__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdFilterAlgoPerf_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 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx", 0);

  /* "cupy/cuda/cudnn.pyx":1318
 *     cdef vector.vector[ConvolutionBwdFilterAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardFilterAlgorithmEx(
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1318, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1319
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardFilterAlgorithmEx(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 *         <TensorDescriptor>dyDesc, <void*>dy, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardFilterAlgorithmEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_dwDesc), ((void *)__pyx_v_dw), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1325
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0],
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1326
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1326, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1327
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1328
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr4__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1327
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr4__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr4__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr4__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr4__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_int_neg_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cupy/cuda/cudnn.pyx":1328
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1312
 * 
 * 
 * cpdef list findConvolutionBackwardFilterAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount,
 */

  /* 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.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_105findConvolutionBackwardFilterAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_104findConvolutionBackwardFilterAlgorithmEx[] = "findConvolutionBackwardFilterAlgorithmEx(intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy, size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_105findConvolutionBackwardFilterAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dwDesc;
  size_t __pyx_v_dw;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_convDesc,&__pyx_n_s_dwDesc,&__pyx_n_s_dw,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 1); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 2); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 3); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 4); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 5); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dwDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 6); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 7); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 8); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 9); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, 10); __PYX_ERR(0, 1312, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardFilterAlgorithmEx") < 0)) __PYX_ERR(0, 1312, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1313, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1314, __pyx_L3_error)
    __pyx_v_dwDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dwDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1314, __pyx_L3_error)
    __pyx_v_dw = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dw == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1314, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1314, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1315, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1315, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1312, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_104findConvolutionBackwardFilterAlgorithmEx(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_104findConvolutionBackwardFilterAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __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.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1331
 * 
 * 
 * cpdef list findConvolutionBackwardFilterAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_107findConvolutionBackwardFilterAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx_v7(intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdFilterAlgoPerf_v7_t __pyx_8genexpr5__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdFilterAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1337
 *     cdef vector.vector[ConvolutionBwdFilterAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardFilterAlgorithmEx_v7(
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1337, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1338
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardFilterAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <TensorDescriptor>xDesc, <void*>x,
 *         <TensorDescriptor>dyDesc, <void*>dy, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardFilterAlgorithmEx_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_dwDesc), ((void *)__pyx_v_dw), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1344
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0],
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1345
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1345, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1346
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1348
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr5__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1346
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr5__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr5__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr5__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr5__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1347
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr5__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr5__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1346
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1348
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1331
 * 
 * 
 * cpdef list findConvolutionBackwardFilterAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount,
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_107findConvolutionBackwardFilterAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_106findConvolutionBackwardFilterAlgorithmEx_v7[] = "findConvolutionBackwardFilterAlgorithmEx_v7(intptr_t handle, size_t xDesc, size_t x, size_t dyDesc, size_t dy, size_t convDesc, size_t dwDesc, size_t dw, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_107findConvolutionBackwardFilterAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dwDesc;
  size_t __pyx_v_dw;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_convDesc,&__pyx_n_s_dwDesc,&__pyx_n_s_dw,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 1); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 2); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 3); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 4); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 5); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dwDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 6); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 7); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 8); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 9); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, 10); __PYX_ERR(0, 1331, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardFilterAlgorithmEx_v7") < 0)) __PYX_ERR(0, 1331, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1332, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1333, __pyx_L3_error)
    __pyx_v_dwDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dwDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1333, __pyx_L3_error)
    __pyx_v_dw = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dw == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1333, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1333, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1334, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1334, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardFilterAlgorithmEx_v7", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_106findConvolutionBackwardFilterAlgorithmEx_v7(__pyx_self, __pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_106findConvolutionBackwardFilterAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardFilterAlgorithmEx_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx_v7(__pyx_v_handle, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __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.cuda.cudnn.findConvolutionBackwardFilterAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1351
 * 
 * 
 * cpdef int getConvolutionBackwardFilterAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t filterDesc, int preference,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_109getConvolutionBackwardFilterAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v6(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnConvolutionBwdFilterAlgo_t __pyx_v_algo;
  int __pyx_v_status;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v6", 0);

  /* "cupy/cuda/cudnn.pyx":1356
 *         size_t memoryLimitInbytes) except? -1:
 *     cdef ConvolutionBwdFilterAlgo algo
 *     status = cudnnGetConvolutionBackwardFilterAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>srcDesc,
 *         <TensorDescriptor>diffDesc, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardFilterAlgorithm_v6(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnConvolutionBwdFilterPreference_t)__pyx_v_preference), __pyx_v_memoryLimitInbytes, (&__pyx_v_algo));

  /* "cupy/cuda/cudnn.pyx":1362
 *         <ConvolutionBwdFilterPreference>preference,
 *         memoryLimitInbytes, &algo)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return algo
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1363
 *         memoryLimitInbytes, &algo)
 *     check_status(status)
 *     return algo             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_algo;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1351
 * 
 * 
 * cpdef int getConvolutionBackwardFilterAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t filterDesc, int preference,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_109getConvolutionBackwardFilterAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_108getConvolutionBackwardFilterAlgorithm_v6[] = "getConvolutionBackwardFilterAlgorithm_v6(intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc, size_t filterDesc, int preference, size_t memoryLimitInbytes) -> int";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_109getConvolutionBackwardFilterAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_filterDesc;
  int __pyx_v_preference;
  size_t __pyx_v_memoryLimitInbytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v6 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_filterDesc,&__pyx_n_s_preference,&__pyx_n_s_memoryLimitInbytes,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 1); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 2); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 3); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 4); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_preference)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 5); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_memoryLimitInbytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, 6); __PYX_ERR(0, 1351, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardFilterAlgorithm_v6") < 0)) __PYX_ERR(0, 1351, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1353, __pyx_L3_error)
    __pyx_v_preference = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_preference == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1353, __pyx_L3_error)
    __pyx_v_memoryLimitInbytes = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_memoryLimitInbytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v6", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1351, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_108getConvolutionBackwardFilterAlgorithm_v6(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_filterDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_108getConvolutionBackwardFilterAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v6", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v6(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_filterDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1351, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1366
 * 
 * 
 * cpdef list getConvolutionBackwardFilterAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_111getConvolutionBackwardFilterAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v7(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdFilterAlgoPerf_v7_t __pyx_8genexpr6__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdFilterAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdFilterAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1371
 *     cdef vector.vector[ConvolutionBwdFilterAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnGetConvolutionBackwardFilterAlgorithm_v7(
 *         <Handle>handle, <TensorDescriptor>srcDesc, <TensorDescriptor>diffDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1371, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1372
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnGetConvolutionBackwardFilterAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>srcDesc, <TensorDescriptor>diffDesc,
 *         <ConvolutionDescriptor>convDesc, <FilterDescriptor>gradDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardFilterAlgorithm_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_gradDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1376
 *         <ConvolutionDescriptor>convDesc, <FilterDescriptor>gradDesc,
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1377
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1377, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1378
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1380
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr6__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1378
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr6__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr6__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr6__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr6__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1379
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr6__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr6__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1378
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1378, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1380
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1366
 * 
 * 
 * cpdef list getConvolutionBackwardFilterAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int requestedAlgoCount):
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_111getConvolutionBackwardFilterAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_110getConvolutionBackwardFilterAlgorithm_v7[] = "getConvolutionBackwardFilterAlgorithm_v7(intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc, size_t gradDesc, int requestedAlgoCount) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_111getConvolutionBackwardFilterAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_gradDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_gradDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, 1); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, 2); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, 3); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, 4); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, 5); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardFilterAlgorithm_v7") < 0)) __PYX_ERR(0, 1366, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1367, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterAlgorithm_v7", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_110getConvolutionBackwardFilterAlgorithm_v7(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_110getConvolutionBackwardFilterAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterAlgorithm_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v7(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_requestedAlgoCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __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.cuda.cudnn.getConvolutionBackwardFilterAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1383
 * 
 * 
 * cpdef Py_ssize_t getConvolutionBackwardFilterWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t filterDesc, int algo) except? -1:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_113getConvolutionBackwardFilterWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_algo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1387
 *         size_t filterDesc, int algo) except? -1:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetConvolutionBackwardFilterWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>srcDesc,
 *         <TensorDescriptor>diffDesc, <ConvolutionDescriptor> convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardFilterWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnConvolutionBwdFilterAlgo_t)__pyx_v_algo), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1392
 *         <FilterDescriptor>filterDesc, <ConvolutionBwdFilterAlgo>algo,
 *         &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <Py_ssize_t>sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1393
 *         &sizeInBytes)
 *     check_status(status)
 *     return <Py_ssize_t>sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((Py_ssize_t)__pyx_v_sizeInBytes);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1383
 * 
 * 
 * cpdef Py_ssize_t getConvolutionBackwardFilterWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc,
 *         size_t filterDesc, int algo) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_113getConvolutionBackwardFilterWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_112getConvolutionBackwardFilterWorkspaceSize[] = "getConvolutionBackwardFilterWorkspaceSize(intptr_t handle, size_t srcDesc, size_t diffDesc, size_t convDesc, size_t filterDesc, int algo) -> Py_ssize_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_113getConvolutionBackwardFilterWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_filterDesc;
  int __pyx_v_algo;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_srcDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_filterDesc,&__pyx_n_s_algo,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, 1); __PYX_ERR(0, 1383, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, 2); __PYX_ERR(0, 1383, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, 3); __PYX_ERR(0, 1383, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, 4); __PYX_ERR(0, 1383, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, 5); __PYX_ERR(0, 1383, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardFilterWorkspaceSize") < 0)) __PYX_ERR(0, 1383, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1384, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1384, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1384, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1384, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardFilterWorkspaceSize", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardFilterWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_112getConvolutionBackwardFilterWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_filterDesc, __pyx_v_algo);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_112getConvolutionBackwardFilterWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_srcDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_filterDesc, int __pyx_v_algo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardFilterWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterWorkspaceSize(__pyx_v_handle, __pyx_v_srcDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_filterDesc, __pyx_v_algo, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L) && PyErr_Occurred())) __PYX_ERR(0, 1383, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1396
 * 
 * 
 * cpdef convolutionBackwardFilter_v3(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t diffDesc, size_t diffData, size_t convDesc, int algo,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_115convolutionBackwardFilter_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardFilter_v3(intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardFilter_v3", 0);

  /* "cupy/cuda/cudnn.pyx":1401
 *         size_t workSpace, size_t workSpaceSizeInBytes, size_t beta,
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnConvolutionBackwardFilter_v3(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1402
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardFilter_v3(
 *             <Handle>handle, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1403
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnConvolutionBackwardFilter_v3(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnConvolutionBackwardFilter_v3(((cudnnHandle_t)__pyx_v_handle), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((void *)__pyx_v_diffData), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnConvolutionBwdFilterAlgo_t)__pyx_v_algo), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_beta), ((cudnnFilterDescriptor_t)__pyx_v_gradDesc), ((void *)__pyx_v_gradData));
      }

      /* "cupy/cuda/cudnn.pyx":1402
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardFilter_v3(
 *             <Handle>handle, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1410
 *             <void*>workSpace, workSpaceSizeInBytes, <void*>beta,
 *             <FilterDescriptor>gradDesc, <void*>gradData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1396
 * 
 * 
 * cpdef convolutionBackwardFilter_v3(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData,
 *         size_t diffDesc, size_t diffData, size_t convDesc, int algo,
 */

  /* 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.cuda.cudnn.convolutionBackwardFilter_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_115convolutionBackwardFilter_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_114convolutionBackwardFilter_v3[] = "convolutionBackwardFilter_v3(intptr_t handle, size_t alpha, size_t srcDesc, size_t srcData, size_t diffDesc, size_t diffData, size_t convDesc, int algo, size_t workSpace, size_t workSpaceSizeInBytes, size_t beta, size_t gradDesc, size_t gradData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_115convolutionBackwardFilter_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_diffData;
  size_t __pyx_v_convDesc;
  int __pyx_v_algo;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_beta;
  size_t __pyx_v_gradDesc;
  size_t __pyx_v_gradData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convolutionBackwardFilter_v3 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_diffDesc,&__pyx_n_s_diffData,&__pyx_n_s_convDesc,&__pyx_n_s_algo,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_beta,&__pyx_n_s_gradDesc,&__pyx_n_s_gradData,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 1); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 2); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 3); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 4); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 5); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 6); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 7); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 8); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 9); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 10); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 11); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, 12); __PYX_ERR(0, 1396, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolutionBackwardFilter_v3") < 0)) __PYX_ERR(0, 1396, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error)
    __pyx_v_diffData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_diffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1400, __pyx_L3_error)
    __pyx_v_gradData = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_gradData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1400, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convolutionBackwardFilter_v3", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1396, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.convolutionBackwardFilter_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_114convolutionBackwardFilter_v3(__pyx_self, __pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_diffDesc, __pyx_v_diffData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_gradDesc, __pyx_v_gradData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_114convolutionBackwardFilter_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardFilter_v3", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardFilter_v3(__pyx_v_handle, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_diffDesc, __pyx_v_diffData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_gradDesc, __pyx_v_gradData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1396, __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.cuda.cudnn.convolutionBackwardFilter_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1413
 * 
 * 
 * cpdef findConvolutionBackwardDataAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t dyDesc, size_t convDesc,
 *         size_t dxDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_117findConvolutionBackwardDataAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithm(intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdDataAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithm", 0);

  /* "cupy/cuda/cudnn.pyx":1418
 *     cdef vector.vector[ConvolutionBwdDataAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardDataAlgorithm(
 *         <Handle> handle, <FilterDescriptor>wDesc, <TensorDescriptor>dyDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1418, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1419
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardDataAlgorithm(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <FilterDescriptor>wDesc, <TensorDescriptor>dyDesc,
 *         <ConvolutionDescriptor>convDesc, <TensorDescriptor>dxDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardDataAlgorithm(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1423
 *         <ConvolutionDescriptor>convDesc, <TensorDescriptor>dxDesc,
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1424
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return perfResults
 * 
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1424, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1425
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return perfResults             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(__pyx_v_perfResults); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1413
 * 
 * 
 * cpdef findConvolutionBackwardDataAlgorithm(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t dyDesc, size_t convDesc,
 *         size_t dxDesc, int requestedAlgoCount):
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_117findConvolutionBackwardDataAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_116findConvolutionBackwardDataAlgorithm[] = "findConvolutionBackwardDataAlgorithm(intptr_t handle, size_t wDesc, size_t dyDesc, size_t convDesc, size_t dxDesc, int requestedAlgoCount)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_117findConvolutionBackwardDataAlgorithm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dxDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_wDesc,&__pyx_n_s_dyDesc,&__pyx_n_s_convDesc,&__pyx_n_s_dxDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, 1); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, 2); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, 3); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, 4); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, 5); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardDataAlgorithm") < 0)) __PYX_ERR(0, 1413, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1415, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1415, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithm", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1413, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardDataAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_116findConvolutionBackwardDataAlgorithm(__pyx_self, __pyx_v_handle, __pyx_v_wDesc, __pyx_v_dyDesc, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_116findConvolutionBackwardDataAlgorithm(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithm", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithm(__pyx_v_handle, __pyx_v_wDesc, __pyx_v_dyDesc, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_requestedAlgoCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1413, __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.cuda.cudnn.findConvolutionBackwardDataAlgorithm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1428
 * 
 * 
 * cpdef list findConvolutionBackwardDataAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dxDesc, size_t dx,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_119findConvolutionBackwardDataAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx(intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdDataAlgoPerf_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdDataAlgoPerf_t __pyx_8genexpr7__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdDataAlgoPerf_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdDataAlgoPerf_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 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx", 0);

  /* "cupy/cuda/cudnn.pyx":1434
 *     cdef vector.vector[ConvolutionBwdDataAlgoPerf] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardDataAlgorithmEx(
 *         <Handle> handle, <FilterDescriptor>wDesc, <void*>w,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1434, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1435
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardDataAlgorithmEx(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <FilterDescriptor>wDesc, <void*>w,
 *         <TensorDescriptor>dyDesc, <void*>dy, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardDataAlgorithmEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1441
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0],
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1442
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1442, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1443
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1444
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr7__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1443
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr7__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr7__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr7__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr7__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_int_neg_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 1443, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "cupy/cuda/cudnn.pyx":1444
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory, -1, -1)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1428
 * 
 * 
 * cpdef list findConvolutionBackwardDataAlgorithmEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dxDesc, size_t dx,
 */

  /* 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.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_119findConvolutionBackwardDataAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_118findConvolutionBackwardDataAlgorithmEx[] = "findConvolutionBackwardDataAlgorithmEx(intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy, size_t convDesc, size_t dxDesc, size_t dx, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_119findConvolutionBackwardDataAlgorithmEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_convDesc,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 1); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 2); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 3); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 4); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 5); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 6); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 7); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 8); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 9); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, 10); __PYX_ERR(0, 1428, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardDataAlgorithmEx") < 0)) __PYX_ERR(0, 1428, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1428, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_118findConvolutionBackwardDataAlgorithmEx(__pyx_self, __pyx_v_handle, __pyx_v_wDesc, __pyx_v_w, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_118findConvolutionBackwardDataAlgorithmEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx(__pyx_v_handle, __pyx_v_wDesc, __pyx_v_w, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1428, __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.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1447
 * 
 * 
 * cpdef list findConvolutionBackwardDataAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dxDesc, size_t dx,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_121findConvolutionBackwardDataAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx_v7(intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdDataAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdDataAlgoPerf_v7_t __pyx_8genexpr8__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdDataAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdDataAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1453
 *     cdef vector.vector[ConvolutionBwdDataAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnFindConvolutionBackwardDataAlgorithmEx_v7(
 *         <Handle> handle, <FilterDescriptor>wDesc, <void*>w,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1453, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1454
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnFindConvolutionBackwardDataAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         <Handle> handle, <FilterDescriptor>wDesc, <void*>w,
 *         <TensorDescriptor>dyDesc, <void*>dy, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnFindConvolutionBackwardDataAlgorithmEx_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);

  /* "cupy/cuda/cudnn.pyx":1460
 *         requestedAlgoCount, &returnedAlgoCount, &perfResults[0],
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1461
 *         <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1461, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1462
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1464
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr8__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1462
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr8__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr8__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr8__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr8__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1463
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr8__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr8__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1462
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1462, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1464
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1447
 * 
 * 
 * cpdef list findConvolutionBackwardDataAlgorithmEx_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy,
 *         size_t convDesc, size_t dxDesc, size_t dx,
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_121findConvolutionBackwardDataAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_120findConvolutionBackwardDataAlgorithmEx_v7[] = "findConvolutionBackwardDataAlgorithmEx_v7(intptr_t handle, size_t wDesc, size_t w, size_t dyDesc, size_t dy, size_t convDesc, size_t dxDesc, size_t dx, int requestedAlgoCount, size_t workSpace, size_t workSpaceSizeInBytes) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_121findConvolutionBackwardDataAlgorithmEx_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  int __pyx_v_requestedAlgoCount;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_convDesc,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_requestedAlgoCount,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 1); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 2); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 3); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 4); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 5); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 6); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 7); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 8); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 9); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, 10); __PYX_ERR(0, 1447, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findConvolutionBackwardDataAlgorithmEx_v7") < 0)) __PYX_ERR(0, 1447, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1449, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1449, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1449, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1450, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1450, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1450, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("findConvolutionBackwardDataAlgorithmEx_v7", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1447, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_120findConvolutionBackwardDataAlgorithmEx_v7(__pyx_self, __pyx_v_handle, __pyx_v_wDesc, __pyx_v_w, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_120findConvolutionBackwardDataAlgorithmEx_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_convDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, int __pyx_v_requestedAlgoCount, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("findConvolutionBackwardDataAlgorithmEx_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx_v7(__pyx_v_handle, __pyx_v_wDesc, __pyx_v_w, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_convDesc, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_requestedAlgoCount, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __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.cuda.cudnn.findConvolutionBackwardDataAlgorithmEx_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1467
 * 
 * 
 * cpdef int getConvolutionBackwardDataAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, size_t preference,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_123getConvolutionBackwardDataAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v6(intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, size_t __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnConvolutionBwdDataAlgo_t __pyx_v_algo;
  int __pyx_v_status;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v6", 0);

  /* "cupy/cuda/cudnn.pyx":1472
 *         size_t memoryLimitInbytes) except? -1:
 *     cdef ConvolutionBwdDataAlgo algo
 *     status = cudnnGetConvolutionBackwardDataAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <FilterDescriptor>filterDesc,
 *         <TensorDescriptor>diffDesc, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardDataAlgorithm_v6(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_gradDesc), ((cudnnConvolutionBwdDataPreference_t)__pyx_v_preference), __pyx_v_memoryLimitInbytes, (&__pyx_v_algo));

  /* "cupy/cuda/cudnn.pyx":1477
 *         <TensorDescriptor>gradDesc, <ConvolutionBwdDataPreference>preference,
 *         memoryLimitInbytes, &algo)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return algo
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1478
 *         memoryLimitInbytes, &algo)
 *     check_status(status)
 *     return algo             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_algo;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1467
 * 
 * 
 * cpdef int getConvolutionBackwardDataAlgorithm_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, size_t preference,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_123getConvolutionBackwardDataAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_122getConvolutionBackwardDataAlgorithm_v6[] = "getConvolutionBackwardDataAlgorithm_v6(intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc, size_t gradDesc, size_t preference, size_t memoryLimitInbytes) -> int";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_123getConvolutionBackwardDataAlgorithm_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_gradDesc;
  size_t __pyx_v_preference;
  size_t __pyx_v_memoryLimitInbytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v6 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_filterDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_gradDesc,&__pyx_n_s_preference,&__pyx_n_s_memoryLimitInbytes,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 1); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 2); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 3); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 4); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_preference)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 5); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_memoryLimitInbytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, 6); __PYX_ERR(0, 1467, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardDataAlgorithm_v6") < 0)) __PYX_ERR(0, 1467, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1469, __pyx_L3_error)
    __pyx_v_preference = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_preference == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1469, __pyx_L3_error)
    __pyx_v_memoryLimitInbytes = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_memoryLimitInbytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1470, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v6", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1467, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataAlgorithm_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_122getConvolutionBackwardDataAlgorithm_v6(__pyx_self, __pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_122getConvolutionBackwardDataAlgorithm_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, size_t __pyx_v_preference, size_t __pyx_v_memoryLimitInbytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v6", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v6(__pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_preference, __pyx_v_memoryLimitInbytes, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1467, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1481
 * 
 * 
 * cpdef list getConvolutionBackwardDataAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int requestedAlgoCount):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_125getConvolutionBackwardDataAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v7(intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount, CYTHON_UNUSED int __pyx_skip_dispatch) {
  std::vector<cudnnConvolutionBwdDataAlgoPerf_v7_t>  __pyx_v_perfResults;
  int __pyx_v_returnedAlgoCount;
  int __pyx_v_status;
  cudnnConvolutionBwdDataAlgoPerf_v7_t __pyx_8genexpr9__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  std::vector<cudnnConvolutionBwdDataAlgoPerf_v7_t> ::iterator __pyx_t_2;
  cudnnConvolutionBwdDataAlgoPerf_v7_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 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v7", 0);

  /* "cupy/cuda/cudnn.pyx":1486
 *     cdef vector.vector[ConvolutionBwdDataAlgoPerf_v7] perfResults
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)             # <<<<<<<<<<<<<<
 *     status = cudnnGetConvolutionBackwardDataAlgorithm_v7(
 *         <Handle>handle, <FilterDescriptor>filterDesc,
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_requestedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1486, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1487
 *     cdef int returnedAlgoCount
 *     perfResults.resize(requestedAlgoCount)
 *     status = cudnnGetConvolutionBackwardDataAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <FilterDescriptor>filterDesc,
 *         <TensorDescriptor>diffDesc, <ConvolutionDescriptor>convDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardDataAlgorithm_v7(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_gradDesc), __pyx_v_requestedAlgoCount, (&__pyx_v_returnedAlgoCount), (&(__pyx_v_perfResults[0])));

  /* "cupy/cuda/cudnn.pyx":1492
 *         <TensorDescriptor>gradDesc, requestedAlgoCount,
 *         &returnedAlgoCount, &perfResults[0])
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1493
 *         &returnedAlgoCount, &perfResults[0])
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)             # <<<<<<<<<<<<<<
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 */
  try {
    __pyx_v_perfResults.resize(__pyx_v_returnedAlgoCount);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1493, __pyx_L1_error)
  }

  /* "cupy/cuda/cudnn.pyx":1494
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "cupy/cuda/cudnn.pyx":1496
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __pyx_v_perfResults.begin();
    for (;;) {
      if (!(__pyx_t_2 != __pyx_v_perfResults.end())) break;
      __pyx_t_3 = *__pyx_t_2;
      ++__pyx_t_2;
      __pyx_8genexpr9__pyx_v_p = __pyx_t_3;

      /* "cupy/cuda/cudnn.pyx":1494
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_8genexpr9__pyx_v_p.algo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_8genexpr9__pyx_v_p.status); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_8genexpr9__pyx_v_p.time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_8genexpr9__pyx_v_p.memory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "cupy/cuda/cudnn.pyx":1495
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)             # <<<<<<<<<<<<<<
 *             for p in perfResults]
 * 
 */
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_8genexpr9__pyx_v_p.determinism); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_8genexpr9__pyx_v_p.mathType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

      /* "cupy/cuda/cudnn.pyx":1494
 *     check_status(status)
 *     perfResults.resize(returnedAlgoCount)
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,             # <<<<<<<<<<<<<<
 *                           p.determinism, p.mathType)
 *             for p in perfResults]
 */
      __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "cupy/cuda/cudnn.pyx":1496
 *     return [CuDNNAlgoPerf(p.algo, p.status, p.time, p.memory,
 *                           p.determinism, p.mathType)
 *             for p in perfResults]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    }
  } /* exit inner scope */
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1481
 * 
 * 
 * cpdef list getConvolutionBackwardDataAlgorithm_v7(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int requestedAlgoCount):
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_125getConvolutionBackwardDataAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_124getConvolutionBackwardDataAlgorithm_v7[] = "getConvolutionBackwardDataAlgorithm_v7(intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc, size_t gradDesc, int requestedAlgoCount) -> list";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_125getConvolutionBackwardDataAlgorithm_v7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_gradDesc;
  int __pyx_v_requestedAlgoCount;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v7 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_filterDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_gradDesc,&__pyx_n_s_requestedAlgoCount,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, 1); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, 2); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, 3); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, 4); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requestedAlgoCount)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, 5); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardDataAlgorithm_v7") < 0)) __PYX_ERR(0, 1481, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L3_error)
    __pyx_v_requestedAlgoCount = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_requestedAlgoCount == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataAlgorithm_v7", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1481, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_124getConvolutionBackwardDataAlgorithm_v7(__pyx_self, __pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_requestedAlgoCount);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_124getConvolutionBackwardDataAlgorithm_v7(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_requestedAlgoCount) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataAlgorithm_v7", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v7(__pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_requestedAlgoCount, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1481, __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.cuda.cudnn.getConvolutionBackwardDataAlgorithm_v7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1499
 * 
 * 
 * cpdef Py_ssize_t getConvolutionBackwardDataWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int algo) except? -1:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_127getConvolutionBackwardDataWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_algo, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1503
 *         size_t gradDesc, int algo) except? -1:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetConvolutionBackwardDataWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <FilterDescriptor>filterDesc,
 *         <TensorDescriptor>diffDesc,
 */
  __pyx_v_status = cudnnGetConvolutionBackwardDataWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnTensorDescriptor_t)__pyx_v_gradDesc), ((cudnnConvolutionBwdDataAlgo_t)__pyx_v_algo), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1508
 *         <ConvolutionDescriptor>convDesc, <TensorDescriptor>gradDesc,
 *         <ConvolutionBwdDataAlgo>algo, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <Py_ssize_t>sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1509
 *         <ConvolutionBwdDataAlgo>algo, &sizeInBytes)
 *     check_status(status)
 *     return <Py_ssize_t>sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((Py_ssize_t)__pyx_v_sizeInBytes);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1499
 * 
 * 
 * cpdef Py_ssize_t getConvolutionBackwardDataWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc,
 *         size_t gradDesc, int algo) except? -1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_127getConvolutionBackwardDataWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_126getConvolutionBackwardDataWorkspaceSize[] = "getConvolutionBackwardDataWorkspaceSize(intptr_t handle, size_t filterDesc, size_t diffDesc, size_t convDesc, size_t gradDesc, int algo) -> Py_ssize_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_127getConvolutionBackwardDataWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_convDesc;
  size_t __pyx_v_gradDesc;
  int __pyx_v_algo;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_filterDesc,&__pyx_n_s_diffDesc,&__pyx_n_s_convDesc,&__pyx_n_s_gradDesc,&__pyx_n_s_algo,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, 1); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, 2); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, 3); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, 4); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, 5); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getConvolutionBackwardDataWorkspaceSize") < 0)) __PYX_ERR(0, 1499, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1500, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1500, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1500, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1500, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1501, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1501, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getConvolutionBackwardDataWorkspaceSize", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getConvolutionBackwardDataWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_126getConvolutionBackwardDataWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_algo);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_126getConvolutionBackwardDataWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_filterDesc, size_t __pyx_v_diffDesc, size_t __pyx_v_convDesc, size_t __pyx_v_gradDesc, int __pyx_v_algo) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getConvolutionBackwardDataWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataWorkspaceSize(__pyx_v_handle, __pyx_v_filterDesc, __pyx_v_diffDesc, __pyx_v_convDesc, __pyx_v_gradDesc, __pyx_v_algo, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L) && PyErr_Occurred())) __PYX_ERR(0, 1499, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1512
 * 
 * 
 * cpdef convolutionBackwardData_v3(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t filterDesc, size_t filterData,
 *         size_t diffDesc, size_t diffData, size_t convDesc, int algo,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_129convolutionBackwardData_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardData_v3(intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardData_v3", 0);

  /* "cupy/cuda/cudnn.pyx":1517
 *         size_t workSpace, size_t workSpaceSizeInBytes, size_t beta,
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnConvolutionBackwardData_v3(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1518
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardData_v3(
 *             <Handle>handle, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1519
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnConvolutionBackwardData_v3(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <void*>alpha,
 *             <FilterDescriptor>filterDesc, <void*>filterData,
 */
        __pyx_v_status = cudnnConvolutionBackwardData_v3(((cudnnHandle_t)__pyx_v_handle), ((void *)__pyx_v_alpha), ((cudnnFilterDescriptor_t)__pyx_v_filterDesc), ((void *)__pyx_v_filterData), ((cudnnTensorDescriptor_t)__pyx_v_diffDesc), ((void *)__pyx_v_diffData), ((cudnnConvolutionDescriptor_t)__pyx_v_convDesc), ((cudnnConvolutionBwdDataAlgo_t)__pyx_v_algo), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_gradDesc), ((void *)__pyx_v_gradData));
      }

      /* "cupy/cuda/cudnn.pyx":1518
 *         size_t gradDesc, size_t gradData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnConvolutionBackwardData_v3(
 *             <Handle>handle, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1526
 *             <void*>workSpace, workSpaceSizeInBytes, <void*>beta,
 *             <TensorDescriptor>gradDesc, <void*>gradData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * ###############################################################################
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1512
 * 
 * 
 * cpdef convolutionBackwardData_v3(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t alpha, size_t filterDesc, size_t filterData,
 *         size_t diffDesc, size_t diffData, size_t convDesc, int algo,
 */

  /* 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.cuda.cudnn.convolutionBackwardData_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_129convolutionBackwardData_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_128convolutionBackwardData_v3[] = "convolutionBackwardData_v3(intptr_t handle, size_t alpha, size_t filterDesc, size_t filterData, size_t diffDesc, size_t diffData, size_t convDesc, int algo, size_t workSpace, size_t workSpaceSizeInBytes, size_t beta, size_t gradDesc, size_t gradData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_129convolutionBackwardData_v3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_alpha;
  size_t __pyx_v_filterDesc;
  size_t __pyx_v_filterData;
  size_t __pyx_v_diffDesc;
  size_t __pyx_v_diffData;
  size_t __pyx_v_convDesc;
  int __pyx_v_algo;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_beta;
  size_t __pyx_v_gradDesc;
  size_t __pyx_v_gradData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convolutionBackwardData_v3 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_alpha,&__pyx_n_s_filterDesc,&__pyx_n_s_filterData,&__pyx_n_s_diffDesc,&__pyx_n_s_diffData,&__pyx_n_s_convDesc,&__pyx_n_s_algo,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_beta,&__pyx_n_s_gradDesc,&__pyx_n_s_gradData,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 1); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 2); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filterData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 3); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 4); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 5); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_convDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 6); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 7); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 8); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 9); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 10); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 11); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, 12); __PYX_ERR(0, 1512, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolutionBackwardData_v3") < 0)) __PYX_ERR(0, 1512, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L3_error)
    __pyx_v_filterDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_filterDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L3_error)
    __pyx_v_filterData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_filterData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L3_error)
    __pyx_v_diffDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_diffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L3_error)
    __pyx_v_diffData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_diffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L3_error)
    __pyx_v_convDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_convDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L3_error)
    __pyx_v_gradDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_gradDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1516, __pyx_L3_error)
    __pyx_v_gradData = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_gradData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1516, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convolutionBackwardData_v3", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.convolutionBackwardData_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_128convolutionBackwardData_v3(__pyx_self, __pyx_v_handle, __pyx_v_alpha, __pyx_v_filterDesc, __pyx_v_filterData, __pyx_v_diffDesc, __pyx_v_diffData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_gradDesc, __pyx_v_gradData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_128convolutionBackwardData_v3(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_alpha, size_t __pyx_v_filterDesc, size_t __pyx_v_filterData, size_t __pyx_v_diffDesc, size_t __pyx_v_diffData, size_t __pyx_v_convDesc, int __pyx_v_algo, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_beta, size_t __pyx_v_gradDesc, size_t __pyx_v_gradData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("convolutionBackwardData_v3", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardData_v3(__pyx_v_handle, __pyx_v_alpha, __pyx_v_filterDesc, __pyx_v_filterData, __pyx_v_diffDesc, __pyx_v_diffData, __pyx_v_convDesc, __pyx_v_algo, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_beta, __pyx_v_gradDesc, __pyx_v_gradData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __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.cuda.cudnn.convolutionBackwardData_v3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1532
 * ###############################################################################
 * 
 * cpdef size_t createPoolingDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef PoolingDescriptor desc
 *     status = cudnnCreatePoolingDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_131createPoolingDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createPoolingDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnPoolingDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createPoolingDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1534
 * cpdef size_t createPoolingDescriptor() except? 0:
 *     cdef PoolingDescriptor desc
 *     status = cudnnCreatePoolingDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreatePoolingDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":1535
 *     cdef PoolingDescriptor desc
 *     status = cudnnCreatePoolingDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1536
 *     status = cudnnCreatePoolingDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1532
 * ###############################################################################
 * 
 * cpdef size_t createPoolingDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef PoolingDescriptor desc
 *     status = cudnnCreatePoolingDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_131createPoolingDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_130createPoolingDescriptor[] = "createPoolingDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_131createPoolingDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPoolingDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_130createPoolingDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_130createPoolingDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createPoolingDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createPoolingDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1532, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1539
 * 
 * 
 * cpdef setPooling2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t poolingDesc, int mode, int maxpoolingNanOpt, int windowHeight,
 *         int windowWidth, int verticalPadding, int horizontalPadding,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_133setPooling2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPooling2dDescriptor_v4(size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_windowHeight, int __pyx_v_windowWidth, int __pyx_v_verticalPadding, int __pyx_v_horizontalPadding, int __pyx_v_verticalStride, int __pyx_v_horizontalStride, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPooling2dDescriptor_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1543
 *         int windowWidth, int verticalPadding, int horizontalPadding,
 *         int verticalStride, int horizontalStride):
 *     status = cudnnSetPooling2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <PoolingDescriptor>poolingDesc, <PoolingMode>mode,
 *         <NanPropagation>maxpoolingNanOpt, windowHeight, windowWidth,
 */
  __pyx_v_status = cudnnSetPooling2dDescriptor_v4(((cudnnPoolingDescriptor_t)__pyx_v_poolingDesc), ((cudnnPoolingMode_t)__pyx_v_mode), ((cudnnNanPropagation_t)__pyx_v_maxpoolingNanOpt), __pyx_v_windowHeight, __pyx_v_windowWidth, __pyx_v_verticalPadding, __pyx_v_horizontalPadding, __pyx_v_verticalStride, __pyx_v_horizontalStride);

  /* "cupy/cuda/cudnn.pyx":1547
 *         <NanPropagation>maxpoolingNanOpt, windowHeight, windowWidth,
 *         verticalPadding, horizontalPadding, verticalStride, horizontalStride)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1539
 * 
 * 
 * cpdef setPooling2dDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t poolingDesc, int mode, int maxpoolingNanOpt, int windowHeight,
 *         int windowWidth, int verticalPadding, int horizontalPadding,
 */

  /* 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.cuda.cudnn.setPooling2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_133setPooling2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_132setPooling2dDescriptor_v4[] = "setPooling2dDescriptor_v4(size_t poolingDesc, int mode, int maxpoolingNanOpt, int windowHeight, int windowWidth, int verticalPadding, int horizontalPadding, int verticalStride, int horizontalStride)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_133setPooling2dDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_poolingDesc;
  int __pyx_v_mode;
  int __pyx_v_maxpoolingNanOpt;
  int __pyx_v_windowHeight;
  int __pyx_v_windowWidth;
  int __pyx_v_verticalPadding;
  int __pyx_v_horizontalPadding;
  int __pyx_v_verticalStride;
  int __pyx_v_horizontalStride;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPooling2dDescriptor_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_poolingDesc,&__pyx_n_s_mode,&__pyx_n_s_maxpoolingNanOpt,&__pyx_n_s_windowHeight,&__pyx_n_s_windowWidth,&__pyx_n_s_verticalPadding,&__pyx_n_s_horizontalPadding,&__pyx_n_s_verticalStride,&__pyx_n_s_horizontalStride,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poolingDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 1); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxpoolingNanOpt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 2); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_windowHeight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 3); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_windowWidth)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 4); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verticalPadding)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 5); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_horizontalPadding)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 6); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verticalStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 7); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_horizontalStride)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, 8); __PYX_ERR(0, 1539, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setPooling2dDescriptor_v4") < 0)) __PYX_ERR(0, 1539, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_poolingDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_poolingDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1540, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1540, __pyx_L3_error)
    __pyx_v_maxpoolingNanOpt = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_maxpoolingNanOpt == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1540, __pyx_L3_error)
    __pyx_v_windowHeight = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_windowHeight == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1540, __pyx_L3_error)
    __pyx_v_windowWidth = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_windowWidth == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L3_error)
    __pyx_v_verticalPadding = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_verticalPadding == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L3_error)
    __pyx_v_horizontalPadding = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_horizontalPadding == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L3_error)
    __pyx_v_verticalStride = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_verticalStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1542, __pyx_L3_error)
    __pyx_v_horizontalStride = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_horizontalStride == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1542, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPooling2dDescriptor_v4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1539, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setPooling2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_132setPooling2dDescriptor_v4(__pyx_self, __pyx_v_poolingDesc, __pyx_v_mode, __pyx_v_maxpoolingNanOpt, __pyx_v_windowHeight, __pyx_v_windowWidth, __pyx_v_verticalPadding, __pyx_v_horizontalPadding, __pyx_v_verticalStride, __pyx_v_horizontalStride);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_132setPooling2dDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_windowHeight, int __pyx_v_windowWidth, int __pyx_v_verticalPadding, int __pyx_v_horizontalPadding, int __pyx_v_verticalStride, int __pyx_v_horizontalStride) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPooling2dDescriptor_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setPooling2dDescriptor_v4(__pyx_v_poolingDesc, __pyx_v_mode, __pyx_v_maxpoolingNanOpt, __pyx_v_windowHeight, __pyx_v_windowWidth, __pyx_v_verticalPadding, __pyx_v_horizontalPadding, __pyx_v_verticalStride, __pyx_v_horizontalStride, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1539, __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.cuda.cudnn.setPooling2dDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1550
 * 
 * 
 * cpdef setPoolingNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t poolingDesc, int mode, int maxpoolingNanOpt, int nbDims,
 *         size_t windowDimA, size_t paddingA, size_t strideA):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_135setPoolingNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPoolingNdDescriptor_v4(size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_nbDims, size_t __pyx_v_windowDimA, size_t __pyx_v_paddingA, size_t __pyx_v_strideA, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPoolingNdDescriptor_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1553
 *         size_t poolingDesc, int mode, int maxpoolingNanOpt, int nbDims,
 *         size_t windowDimA, size_t paddingA, size_t strideA):
 *     status = cudnnSetPoolingNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         <PoolingDescriptor>poolingDesc, <PoolingMode>mode,
 *         <NanPropagation>maxpoolingNanOpt, nbDims,
 */
  __pyx_v_status = cudnnSetPoolingNdDescriptor_v4(((cudnnPoolingDescriptor_t)__pyx_v_poolingDesc), ((cudnnPoolingMode_t)__pyx_v_mode), ((cudnnNanPropagation_t)__pyx_v_maxpoolingNanOpt), __pyx_v_nbDims, ((int *)__pyx_v_windowDimA), ((int *)__pyx_v_paddingA), ((int *)__pyx_v_strideA));

  /* "cupy/cuda/cudnn.pyx":1557
 *         <NanPropagation>maxpoolingNanOpt, nbDims,
 *         <int*>windowDimA, <int*>paddingA, <int*>strideA)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1550
 * 
 * 
 * cpdef setPoolingNdDescriptor_v4(             # <<<<<<<<<<<<<<
 *         size_t poolingDesc, int mode, int maxpoolingNanOpt, int nbDims,
 *         size_t windowDimA, size_t paddingA, size_t strideA):
 */

  /* 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.cuda.cudnn.setPoolingNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_135setPoolingNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_134setPoolingNdDescriptor_v4[] = "setPoolingNdDescriptor_v4(size_t poolingDesc, int mode, int maxpoolingNanOpt, int nbDims, size_t windowDimA, size_t paddingA, size_t strideA)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_135setPoolingNdDescriptor_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_poolingDesc;
  int __pyx_v_mode;
  int __pyx_v_maxpoolingNanOpt;
  int __pyx_v_nbDims;
  size_t __pyx_v_windowDimA;
  size_t __pyx_v_paddingA;
  size_t __pyx_v_strideA;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPoolingNdDescriptor_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_poolingDesc,&__pyx_n_s_mode,&__pyx_n_s_maxpoolingNanOpt,&__pyx_n_s_nbDims,&__pyx_n_s_windowDimA,&__pyx_n_s_paddingA,&__pyx_n_s_strideA,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poolingDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 1); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxpoolingNanOpt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 2); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbDims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 3); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_windowDimA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 4); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paddingA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 5); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strideA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, 6); __PYX_ERR(0, 1550, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setPoolingNdDescriptor_v4") < 0)) __PYX_ERR(0, 1550, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_poolingDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_poolingDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
    __pyx_v_maxpoolingNanOpt = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_maxpoolingNanOpt == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
    __pyx_v_nbDims = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nbDims == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1551, __pyx_L3_error)
    __pyx_v_windowDimA = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_windowDimA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1552, __pyx_L3_error)
    __pyx_v_paddingA = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_paddingA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1552, __pyx_L3_error)
    __pyx_v_strideA = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_strideA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1552, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPoolingNdDescriptor_v4", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1550, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setPoolingNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_134setPoolingNdDescriptor_v4(__pyx_self, __pyx_v_poolingDesc, __pyx_v_mode, __pyx_v_maxpoolingNanOpt, __pyx_v_nbDims, __pyx_v_windowDimA, __pyx_v_paddingA, __pyx_v_strideA);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_134setPoolingNdDescriptor_v4(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc, int __pyx_v_mode, int __pyx_v_maxpoolingNanOpt, int __pyx_v_nbDims, size_t __pyx_v_windowDimA, size_t __pyx_v_paddingA, size_t __pyx_v_strideA) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPoolingNdDescriptor_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setPoolingNdDescriptor_v4(__pyx_v_poolingDesc, __pyx_v_mode, __pyx_v_maxpoolingNanOpt, __pyx_v_nbDims, __pyx_v_windowDimA, __pyx_v_paddingA, __pyx_v_strideA, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1550, __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.cuda.cudnn.setPoolingNdDescriptor_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1560
 * 
 * 
 * cpdef destroyPoolingDescriptor(size_t poolingDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyPoolingDescriptor(<PoolingDescriptor>poolingDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_137destroyPoolingDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_poolingDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyPoolingDescriptor(size_t __pyx_v_poolingDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyPoolingDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1561
 * 
 * cpdef destroyPoolingDescriptor(size_t poolingDesc):
 *     status = cudnnDestroyPoolingDescriptor(<PoolingDescriptor>poolingDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyPoolingDescriptor(((cudnnPoolingDescriptor_t)__pyx_v_poolingDesc));

  /* "cupy/cuda/cudnn.pyx":1562
 * cpdef destroyPoolingDescriptor(size_t poolingDesc):
 *     status = cudnnDestroyPoolingDescriptor(<PoolingDescriptor>poolingDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1560
 * 
 * 
 * cpdef destroyPoolingDescriptor(size_t poolingDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyPoolingDescriptor(<PoolingDescriptor>poolingDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyPoolingDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_137destroyPoolingDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_poolingDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_136destroyPoolingDescriptor[] = "destroyPoolingDescriptor(size_t poolingDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_137destroyPoolingDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_poolingDesc) {
  size_t __pyx_v_poolingDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyPoolingDescriptor (wrapper)", 0);
  assert(__pyx_arg_poolingDesc); {
    __pyx_v_poolingDesc = __Pyx_PyInt_As_size_t(__pyx_arg_poolingDesc); if (unlikely((__pyx_v_poolingDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyPoolingDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_136destroyPoolingDescriptor(__pyx_self, ((size_t)__pyx_v_poolingDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_136destroyPoolingDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_poolingDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyPoolingDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyPoolingDescriptor(__pyx_v_poolingDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __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.cuda.cudnn.destroyPoolingDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1565
 * 
 * 
 * cpdef poolingForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_139poolingForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_poolingForward(intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("poolingForward", 0);

  /* "cupy/cuda/cudnn.pyx":1568
 *         intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnPoolingForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1569
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnPoolingForward(
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1570
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnPoolingForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 */
        __pyx_v_status = cudnnPoolingForward(((cudnnHandle_t)__pyx_v_handle), ((cudnnPoolingDescriptor_t)__pyx_v_poolingDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_dstDesc), ((void *)__pyx_v_dstData));
      }

      /* "cupy/cuda/cudnn.pyx":1569
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnPoolingForward(
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1574
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 *             <TensorDescriptor>dstDesc, <void*>dstData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1565
 * 
 * 
 * cpdef poolingForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

  /* 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.cuda.cudnn.poolingForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_139poolingForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_138poolingForward[] = "poolingForward(intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc, size_t srcData, size_t beta, size_t dstDesc, size_t dstData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_139poolingForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_poolingDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_beta;
  size_t __pyx_v_dstDesc;
  size_t __pyx_v_dstData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poolingForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_poolingDesc,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_beta,&__pyx_n_s_dstDesc,&__pyx_n_s_dstData,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poolingDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 1); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 2); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 3); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 4); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 5); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 6); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, 7); __PYX_ERR(0, 1565, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poolingForward") < 0)) __PYX_ERR(0, 1565, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L3_error)
    __pyx_v_poolingDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_poolingDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1567, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1567, __pyx_L3_error)
    __pyx_v_dstDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dstDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1567, __pyx_L3_error)
    __pyx_v_dstData = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dstData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1567, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poolingForward", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1565, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.poolingForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_138poolingForward(__pyx_self, __pyx_v_handle, __pyx_v_poolingDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_138poolingForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("poolingForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_poolingForward(__pyx_v_handle, __pyx_v_poolingDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __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.cuda.cudnn.poolingForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1577
 * 
 * 
 * cpdef poolingBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_141poolingBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_poolingBackward(intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("poolingBackward", 0);

  /* "cupy/cuda/cudnn.pyx":1582
 *         size_t destDesc, size_t destData, size_t beta, size_t destDiffDesc,
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnPoolingBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1583
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnPoolingBackward(
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1584
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnPoolingBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnPoolingBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnPoolingDescriptor_t)__pyx_v_poolingDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnTensorDescriptor_t)__pyx_v_srcDiffDesc), ((void *)__pyx_v_srcDiffData), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((void *)__pyx_v_destData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_destDiffDesc), ((void *)__pyx_v_destDiffData));
      }

      /* "cupy/cuda/cudnn.pyx":1583
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnPoolingBackward(
 *             <Handle>handle, <PoolingDescriptor>poolingDesc, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1590
 *             <TensorDescriptor>destDesc, <void*>destData, <void*>beta,
 *             <TensorDescriptor>destDiffDesc, <void*>destDiffData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * ###############################################################################
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1577
 * 
 * 
 * cpdef poolingBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData,
 */

  /* 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.cuda.cudnn.poolingBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_141poolingBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_140poolingBackward[] = "poolingBackward(intptr_t handle, size_t poolingDesc, size_t alpha, size_t srcDesc, size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t destDesc, size_t destData, size_t beta, size_t destDiffDesc, size_t destDiffData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_141poolingBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_poolingDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_srcDiffDesc;
  size_t __pyx_v_srcDiffData;
  size_t __pyx_v_destDesc;
  size_t __pyx_v_destData;
  size_t __pyx_v_beta;
  size_t __pyx_v_destDiffDesc;
  size_t __pyx_v_destDiffData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poolingBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_poolingDesc,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_srcDiffDesc,&__pyx_n_s_srcDiffData,&__pyx_n_s_destDesc,&__pyx_n_s_destData,&__pyx_n_s_beta,&__pyx_n_s_destDiffDesc,&__pyx_n_s_destDiffData,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poolingDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 1); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 2); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 3); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 4); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 5); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 6); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 7); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 8); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 9); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 10); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, 11); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poolingBackward") < 0)) __PYX_ERR(0, 1577, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1578, __pyx_L3_error)
    __pyx_v_poolingDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_poolingDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1578, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1578, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1578, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1579, __pyx_L3_error)
    __pyx_v_srcDiffDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_srcDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1579, __pyx_L3_error)
    __pyx_v_srcDiffData = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_srcDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1579, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1580, __pyx_L3_error)
    __pyx_v_destData = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_destData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1580, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1580, __pyx_L3_error)
    __pyx_v_destDiffDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_destDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1580, __pyx_L3_error)
    __pyx_v_destDiffData = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_destDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poolingBackward", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.poolingBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_140poolingBackward(__pyx_self, __pyx_v_handle, __pyx_v_poolingDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_destDesc, __pyx_v_destData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_140poolingBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_poolingDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("poolingBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_poolingBackward(__pyx_v_handle, __pyx_v_poolingDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_destDesc, __pyx_v_destData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __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.cuda.cudnn.poolingBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1598
 * CUDNN_BN_MIN_EPSILON = _CUDNN_BN_MIN_EPSILON
 * 
 * cpdef deriveBNTensorDescriptor(             # <<<<<<<<<<<<<<
 *         size_t derivedBnDesc, size_t xDesc, int mode):
 *     status = cudnnDeriveBNTensorDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_143deriveBNTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_deriveBNTensorDescriptor(size_t __pyx_v_derivedBnDesc, size_t __pyx_v_xDesc, int __pyx_v_mode, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("deriveBNTensorDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1600
 * cpdef deriveBNTensorDescriptor(
 *         size_t derivedBnDesc, size_t xDesc, int mode):
 *     status = cudnnDeriveBNTensorDescriptor(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>derivedBnDesc, <TensorDescriptor>xDesc,
 *         <BatchNormMode> mode)
 */
  __pyx_v_status = cudnnDeriveBNTensorDescriptor(((cudnnTensorDescriptor_t)__pyx_v_derivedBnDesc), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnBatchNormMode_t)__pyx_v_mode));

  /* "cupy/cuda/cudnn.pyx":1603
 *         <TensorDescriptor>derivedBnDesc, <TensorDescriptor>xDesc,
 *         <BatchNormMode> mode)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1598
 * CUDNN_BN_MIN_EPSILON = _CUDNN_BN_MIN_EPSILON
 * 
 * cpdef deriveBNTensorDescriptor(             # <<<<<<<<<<<<<<
 *         size_t derivedBnDesc, size_t xDesc, int mode):
 *     status = cudnnDeriveBNTensorDescriptor(
 */

  /* 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.cuda.cudnn.deriveBNTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_143deriveBNTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_142deriveBNTensorDescriptor[] = "deriveBNTensorDescriptor(size_t derivedBnDesc, size_t xDesc, int mode)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_143deriveBNTensorDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_derivedBnDesc;
  size_t __pyx_v_xDesc;
  int __pyx_v_mode;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deriveBNTensorDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_derivedBnDesc,&__pyx_n_s_xDesc,&__pyx_n_s_mode,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_derivedBnDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("deriveBNTensorDescriptor", 1, 3, 3, 1); __PYX_ERR(0, 1598, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("deriveBNTensorDescriptor", 1, 3, 3, 2); __PYX_ERR(0, 1598, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deriveBNTensorDescriptor") < 0)) __PYX_ERR(0, 1598, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_derivedBnDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_derivedBnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("deriveBNTensorDescriptor", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1598, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.deriveBNTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_142deriveBNTensorDescriptor(__pyx_self, __pyx_v_derivedBnDesc, __pyx_v_xDesc, __pyx_v_mode);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_142deriveBNTensorDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_derivedBnDesc, size_t __pyx_v_xDesc, int __pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("deriveBNTensorDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_deriveBNTensorDescriptor(__pyx_v_derivedBnDesc, __pyx_v_xDesc, __pyx_v_mode, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1598, __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.cuda.cudnn.deriveBNTensorDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1606
 * 
 * 
 * cpdef batchNormalizationForwardTraining(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alpha, size_t beta, size_t xDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_145batchNormalizationForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTraining(intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardTraining", 0);

  /* "cupy/cuda/cudnn.pyx":1614
 *         size_t resultRunningMean, size_t resultRunningVariance,
 *         double epsilon, size_t resultSaveMean, size_t resultSaveInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardTraining(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1615
 *         double epsilon, size_t resultSaveMean, size_t resultSaveInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardTraining(
 *             <Handle>handle, <BatchNormMode> mode,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1616
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardTraining(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <BatchNormMode> mode,
 *             <void*>alpha, <void*>beta, <TensorDescriptor>xDesc,
 */
        __pyx_v_status = cudnnBatchNormalizationForwardTraining(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((void *)__pyx_v_alpha), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_bnScaleBiasMeanVarDesc), ((void *)__pyx_v_bnScale), ((void *)__pyx_v_bnBias), __pyx_v_exponentialAverageFactor, ((void *)__pyx_v_resultRunningMean), ((void *)__pyx_v_resultRunningVariance), __pyx_v_epsilon, ((void *)__pyx_v_resultSaveMean), ((void *)__pyx_v_resultSaveInvVariance));
      }

      /* "cupy/cuda/cudnn.pyx":1615
 *         double epsilon, size_t resultSaveMean, size_t resultSaveInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardTraining(
 *             <Handle>handle, <BatchNormMode> mode,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1624
 *             <void*>resultRunningMean, <void*>resultRunningVariance,
 *             epsilon, <void*>resultSaveMean, <void*>resultSaveInvVariance)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1606
 * 
 * 
 * cpdef batchNormalizationForwardTraining(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alpha, size_t beta, size_t xDesc,
 */

  /* 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.cuda.cudnn.batchNormalizationForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_145batchNormalizationForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_144batchNormalizationForwardTraining[] = "batchNormalizationForwardTraining(intptr_t handle, int mode, size_t alpha, size_t beta, size_t xDesc, size_t x, size_t yDesc, size_t y, size_t bnScaleBiasMeanVarDesc, size_t bnScale, size_t bnBias, double exponentialAverageFactor, size_t resultRunningMean, size_t resultRunningVariance, double epsilon, size_t resultSaveMean, size_t resultSaveInvVariance)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_145batchNormalizationForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  size_t __pyx_v_alpha;
  size_t __pyx_v_beta;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_bnScaleBiasMeanVarDesc;
  size_t __pyx_v_bnScale;
  size_t __pyx_v_bnBias;
  double __pyx_v_exponentialAverageFactor;
  size_t __pyx_v_resultRunningMean;
  size_t __pyx_v_resultRunningVariance;
  double __pyx_v_epsilon;
  size_t __pyx_v_resultSaveMean;
  size_t __pyx_v_resultSaveInvVariance;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("batchNormalizationForwardTraining (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_bnScaleBiasMeanVarDesc,&__pyx_n_s_bnScale,&__pyx_n_s_bnBias,&__pyx_n_s_exponentialAverageFactor,&__pyx_n_s_resultRunningMean,&__pyx_n_s_resultRunningVariance,&__pyx_n_s_epsilon,&__pyx_n_s_resultSaveMean,&__pyx_n_s_resultSaveInvVariance,0};
    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 1); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 2); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 3); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 4); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 5); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 6); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 7); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScaleBiasMeanVarDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 8); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScale)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 9); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnBias)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 10); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponentialAverageFactor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 11); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultRunningMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 12); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultRunningVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 13); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 14); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultSaveMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 15); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultSaveInvVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, 16); __PYX_ERR(0, 1606, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "batchNormalizationForwardTraining") < 0)) __PYX_ERR(0, 1606, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 17) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1608, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1608, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1608, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error)
    __pyx_v_bnScaleBiasMeanVarDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_bnScaleBiasMeanVarDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1610, __pyx_L3_error)
    __pyx_v_bnScale = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_bnScale == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1610, __pyx_L3_error)
    __pyx_v_bnBias = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_bnBias == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1611, __pyx_L3_error)
    __pyx_v_exponentialAverageFactor = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_exponentialAverageFactor == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1611, __pyx_L3_error)
    __pyx_v_resultRunningMean = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_resultRunningMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L3_error)
    __pyx_v_resultRunningVariance = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_resultRunningVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L3_error)
    __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1613, __pyx_L3_error)
    __pyx_v_resultSaveMean = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_resultSaveMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1613, __pyx_L3_error)
    __pyx_v_resultSaveInvVariance = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_resultSaveInvVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1613, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTraining", 1, 17, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1606, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.batchNormalizationForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_144batchNormalizationForwardTraining(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_exponentialAverageFactor, __pyx_v_resultRunningMean, __pyx_v_resultRunningVariance, __pyx_v_epsilon, __pyx_v_resultSaveMean, __pyx_v_resultSaveInvVariance);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_144batchNormalizationForwardTraining(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardTraining", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTraining(__pyx_v_handle, __pyx_v_mode, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_exponentialAverageFactor, __pyx_v_resultRunningMean, __pyx_v_resultRunningVariance, __pyx_v_epsilon, __pyx_v_resultSaveMean, __pyx_v_resultSaveInvVariance, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1606, __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.cuda.cudnn.batchNormalizationForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1627
 * 
 * 
 * cpdef batchNormalizationForwardInference(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alpha, size_t beta, size_t xDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_147batchNormalizationForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardInference(intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, size_t __pyx_v_estimatedMean, size_t __pyx_v_estimatedVariance, double __pyx_v_epsilon, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardInference", 0);

  /* "cupy/cuda/cudnn.pyx":1634
 *         size_t bnBias, size_t estimatedMean, size_t estimatedVariance,
 *         double epsilon):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardInference(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1635
 *         double epsilon):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardInference(
 *             <Handle>handle, <BatchNormMode> mode,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1636
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardInference(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <BatchNormMode> mode,
 *             <void*>alpha, <void*>beta, <TensorDescriptor>xDesc,
 */
        __pyx_v_status = cudnnBatchNormalizationForwardInference(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((void *)__pyx_v_alpha), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_bnScaleBiasMeanVarDesc), ((void *)__pyx_v_bnScale), ((void *)__pyx_v_bnBias), ((void *)__pyx_v_estimatedMean), ((void *)__pyx_v_estimatedVariance), __pyx_v_epsilon);
      }

      /* "cupy/cuda/cudnn.pyx":1635
 *         double epsilon):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardInference(
 *             <Handle>handle, <BatchNormMode> mode,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1643
 *             <void*>bnBias, <void*>estimatedMean, <void*>estimatedVariance,
 *             epsilon)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1627
 * 
 * 
 * cpdef batchNormalizationForwardInference(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alpha, size_t beta, size_t xDesc,
 */

  /* 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.cuda.cudnn.batchNormalizationForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_147batchNormalizationForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_146batchNormalizationForwardInference[] = "batchNormalizationForwardInference(intptr_t handle, int mode, size_t alpha, size_t beta, size_t xDesc, size_t x, size_t yDesc, size_t y, size_t bnScaleBiasMeanVarDesc, size_t bnScale, size_t bnBias, size_t estimatedMean, size_t estimatedVariance, double epsilon)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_147batchNormalizationForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  size_t __pyx_v_alpha;
  size_t __pyx_v_beta;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_bnScaleBiasMeanVarDesc;
  size_t __pyx_v_bnScale;
  size_t __pyx_v_bnBias;
  size_t __pyx_v_estimatedMean;
  size_t __pyx_v_estimatedVariance;
  double __pyx_v_epsilon;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("batchNormalizationForwardInference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_bnScaleBiasMeanVarDesc,&__pyx_n_s_bnScale,&__pyx_n_s_bnBias,&__pyx_n_s_estimatedMean,&__pyx_n_s_estimatedVariance,&__pyx_n_s_epsilon,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 1); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 2); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 3); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 4); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 5); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 6); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 7); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScaleBiasMeanVarDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 8); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScale)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 9); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnBias)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 10); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_estimatedMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 11); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_estimatedVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 12); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, 13); __PYX_ERR(0, 1627, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "batchNormalizationForwardInference") < 0)) __PYX_ERR(0, 1627, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 14) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1629, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1630, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1630, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1630, __pyx_L3_error)
    __pyx_v_bnScaleBiasMeanVarDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_bnScaleBiasMeanVarDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1631, __pyx_L3_error)
    __pyx_v_bnScale = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_bnScale == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1631, __pyx_L3_error)
    __pyx_v_bnBias = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_bnBias == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1632, __pyx_L3_error)
    __pyx_v_estimatedMean = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_estimatedMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1632, __pyx_L3_error)
    __pyx_v_estimatedVariance = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_estimatedVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1632, __pyx_L3_error)
    __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1633, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardInference", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1627, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.batchNormalizationForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_146batchNormalizationForwardInference(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_estimatedMean, __pyx_v_estimatedVariance, __pyx_v_epsilon);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_146batchNormalizationForwardInference(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, size_t __pyx_v_estimatedMean, size_t __pyx_v_estimatedVariance, double __pyx_v_epsilon) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardInference", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardInference(__pyx_v_handle, __pyx_v_mode, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_estimatedMean, __pyx_v_estimatedVariance, __pyx_v_epsilon, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1627, __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.cuda.cudnn.batchNormalizationForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1646
 * 
 * 
 * cpdef batchNormalizationBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alphaDataDiff, size_t betaDataDiff,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_149batchNormalizationBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackward(intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScale, size_t __pyx_v_dBnScaleResult, size_t __pyx_v_dBnBiasResult, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationBackward", 0);

  /* "cupy/cuda/cudnn.pyx":1655
 *         size_t dBnScaleResult, size_t dBnBiasResult,
 *         double epsilon, size_t savedMean, size_t savedInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnBatchNormalizationBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1656
 *         double epsilon, size_t savedMean, size_t savedInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationBackward(
 *             <Handle>handle, <BatchNormMode>mode,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1657
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnBatchNormalizationBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <BatchNormMode>mode,
 *             <void*>alphaDataDiff, <void*>betaDataDiff,
 */
        __pyx_v_status = cudnnBatchNormalizationBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((void *)__pyx_v_alphaDataDiff), ((void *)__pyx_v_betaDataDiff), ((void *)__pyx_v_alphaParamDiff), ((void *)__pyx_v_betaParamDiff), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), ((cudnnTensorDescriptor_t)__pyx_v_dBnScaleBiasDesc), ((void *)__pyx_v_bnScale), ((void *)__pyx_v_dBnScaleResult), ((void *)__pyx_v_dBnBiasResult), __pyx_v_epsilon, ((void *)__pyx_v_savedMean), ((void *)__pyx_v_savedInvVariance));
      }

      /* "cupy/cuda/cudnn.pyx":1656
 *         double epsilon, size_t savedMean, size_t savedInvVariance):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationBackward(
 *             <Handle>handle, <BatchNormMode>mode,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1667
 *             <void*>dBnScaleResult, <void*>dBnBiasResult,
 *             epsilon, <void*>savedMean, <void*>savedInvVariance)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1646
 * 
 * 
 * cpdef batchNormalizationBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode,
 *         size_t alphaDataDiff, size_t betaDataDiff,
 */

  /* 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.cuda.cudnn.batchNormalizationBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_149batchNormalizationBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_148batchNormalizationBackward[] = "batchNormalizationBackward(intptr_t handle, int mode, size_t alphaDataDiff, size_t betaDataDiff, size_t alphaParamDiff, size_t betaParamDiff, size_t xDesc, size_t x, size_t dyDesc, size_t dy, size_t dxDesc, size_t dx, size_t dBnScaleBiasDesc, size_t bnScale, size_t dBnScaleResult, size_t dBnBiasResult, double epsilon, size_t savedMean, size_t savedInvVariance)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_149batchNormalizationBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  size_t __pyx_v_alphaDataDiff;
  size_t __pyx_v_betaDataDiff;
  size_t __pyx_v_alphaParamDiff;
  size_t __pyx_v_betaParamDiff;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  size_t __pyx_v_dBnScaleBiasDesc;
  size_t __pyx_v_bnScale;
  size_t __pyx_v_dBnScaleResult;
  size_t __pyx_v_dBnBiasResult;
  double __pyx_v_epsilon;
  size_t __pyx_v_savedMean;
  size_t __pyx_v_savedInvVariance;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("batchNormalizationBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_alphaDataDiff,&__pyx_n_s_betaDataDiff,&__pyx_n_s_alphaParamDiff,&__pyx_n_s_betaParamDiff,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_dBnScaleBiasDesc,&__pyx_n_s_bnScale,&__pyx_n_s_dBnScaleResult,&__pyx_n_s_dBnBiasResult,&__pyx_n_s_epsilon,&__pyx_n_s_savedMean,&__pyx_n_s_savedInvVariance,0};
    PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 1); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alphaDataDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 2); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_betaDataDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 3); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alphaParamDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 4); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_betaParamDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 5); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 6); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 7); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 8); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 9); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 10); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 11); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnScaleBiasDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 12); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScale)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 13); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnScaleResult)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 14); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnBiasResult)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 15); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 16); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_savedMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 17); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_savedInvVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, 18); __PYX_ERR(0, 1646, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "batchNormalizationBackward") < 0)) __PYX_ERR(0, 1646, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 19) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1647, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1647, __pyx_L3_error)
    __pyx_v_alphaDataDiff = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alphaDataDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1648, __pyx_L3_error)
    __pyx_v_betaDataDiff = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_betaDataDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1648, __pyx_L3_error)
    __pyx_v_alphaParamDiff = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_alphaParamDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1649, __pyx_L3_error)
    __pyx_v_betaParamDiff = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_betaParamDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1649, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error)
    __pyx_v_dBnScaleBiasDesc = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_dBnScaleBiasDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L3_error)
    __pyx_v_bnScale = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_bnScale == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L3_error)
    __pyx_v_dBnScaleResult = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_dBnScaleResult == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1653, __pyx_L3_error)
    __pyx_v_dBnBiasResult = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_dBnBiasResult == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1653, __pyx_L3_error)
    __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1654, __pyx_L3_error)
    __pyx_v_savedMean = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_savedMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1654, __pyx_L3_error)
    __pyx_v_savedInvVariance = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_savedInvVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1654, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("batchNormalizationBackward", 1, 19, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1646, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.batchNormalizationBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_148batchNormalizationBackward(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_alphaDataDiff, __pyx_v_betaDataDiff, __pyx_v_alphaParamDiff, __pyx_v_betaParamDiff, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dBnScaleBiasDesc, __pyx_v_bnScale, __pyx_v_dBnScaleResult, __pyx_v_dBnBiasResult, __pyx_v_epsilon, __pyx_v_savedMean, __pyx_v_savedInvVariance);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_148batchNormalizationBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScale, size_t __pyx_v_dBnScaleResult, size_t __pyx_v_dBnBiasResult, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackward(__pyx_v_handle, __pyx_v_mode, __pyx_v_alphaDataDiff, __pyx_v_betaDataDiff, __pyx_v_alphaParamDiff, __pyx_v_betaParamDiff, __pyx_v_xDesc, __pyx_v_x, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dBnScaleBiasDesc, __pyx_v_bnScale, __pyx_v_dBnScaleResult, __pyx_v_dBnBiasResult, __pyx_v_epsilon, __pyx_v_savedMean, __pyx_v_savedInvVariance, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1646, __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.cuda.cudnn.batchNormalizationBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1670
 * 
 * 
 * cpdef batchNormalizationForwardTrainingEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t alpha, size_t beta,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_151batchNormalizationForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTrainingEx(intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_zDesc, size_t __pyx_v_z, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardTrainingEx", 0);

  /* "cupy/cuda/cudnn.pyx":1684
 *         size_t workSpace, size_t workSpaceSizeInBytes,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardTrainingEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1685
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardTrainingEx(
 *             <Handle>handle, <BatchNormMode> mode, <BatchNormOps> bnOps,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1686
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnBatchNormalizationForwardTrainingEx(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <BatchNormMode> mode, <BatchNormOps> bnOps,
 *             <void*>alpha, <void*>beta,
 */
        __pyx_v_status = cudnnBatchNormalizationForwardTrainingEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((cudnnBatchNormOps_t)__pyx_v_bnOps), ((void *)__pyx_v_alpha), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_zDesc), ((void *)__pyx_v_z), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_bnScaleBiasMeanVarDesc), ((void *)__pyx_v_bnScale), ((void *)__pyx_v_bnBias), __pyx_v_exponentialAverageFactor, ((void *)__pyx_v_resultRunningMean), ((void *)__pyx_v_resultRunningVariance), __pyx_v_epsilon, ((void *)__pyx_v_resultSaveMean), ((void *)__pyx_v_resultSaveInvVariance), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":1685
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationForwardTrainingEx(
 *             <Handle>handle, <BatchNormMode> mode, <BatchNormOps> bnOps,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1700
 *             <void*>workSpace, workSpaceSizeInBytes,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1670
 * 
 * 
 * cpdef batchNormalizationForwardTrainingEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t alpha, size_t beta,
 */

  /* 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.cuda.cudnn.batchNormalizationForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_151batchNormalizationForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_150batchNormalizationForwardTrainingEx[] = "batchNormalizationForwardTrainingEx(intptr_t handle, int mode, int bnOps, size_t alpha, size_t beta, size_t xDesc, size_t x, size_t zDesc, size_t z, size_t yDesc, size_t y, size_t bnScaleBiasMeanVarDesc, size_t bnScale, size_t bnBias, double exponentialAverageFactor, size_t resultRunningMean, size_t resultRunningVariance, double epsilon, size_t resultSaveMean, size_t resultSaveInvVariance, size_t activationDesc, size_t workSpace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_151batchNormalizationForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  int __pyx_v_bnOps;
  size_t __pyx_v_alpha;
  size_t __pyx_v_beta;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_zDesc;
  size_t __pyx_v_z;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_bnScaleBiasMeanVarDesc;
  size_t __pyx_v_bnScale;
  size_t __pyx_v_bnBias;
  double __pyx_v_exponentialAverageFactor;
  size_t __pyx_v_resultRunningMean;
  size_t __pyx_v_resultRunningVariance;
  double __pyx_v_epsilon;
  size_t __pyx_v_resultSaveMean;
  size_t __pyx_v_resultSaveInvVariance;
  size_t __pyx_v_activationDesc;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("batchNormalizationForwardTrainingEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_bnOps,&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_zDesc,&__pyx_n_s_z,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_bnScaleBiasMeanVarDesc,&__pyx_n_s_bnScale,&__pyx_n_s_bnBias,&__pyx_n_s_exponentialAverageFactor,&__pyx_n_s_resultRunningMean,&__pyx_n_s_resultRunningVariance,&__pyx_n_s_epsilon,&__pyx_n_s_resultSaveMean,&__pyx_n_s_resultSaveInvVariance,&__pyx_n_s_activationDesc,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[25] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 1); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnOps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 2); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 3); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 4); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 5); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 6); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 7); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 8); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 9); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 10); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScaleBiasMeanVarDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 11); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScale)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 12); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnBias)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 13); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponentialAverageFactor)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 14); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultRunningMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 15); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultRunningVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 16); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 17); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultSaveMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 18); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resultSaveInvVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 19); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 20); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 21); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 22); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 23); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, 24); __PYX_ERR(0, 1670, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "batchNormalizationForwardTrainingEx") < 0)) __PYX_ERR(0, 1670, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 25) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1671, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1671, __pyx_L3_error)
    __pyx_v_bnOps = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bnOps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1671, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1672, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1672, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1673, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1673, __pyx_L3_error)
    __pyx_v_zDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_zDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1674, __pyx_L3_error)
    __pyx_v_z = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_z == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1674, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1675, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1675, __pyx_L3_error)
    __pyx_v_bnScaleBiasMeanVarDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_bnScaleBiasMeanVarDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1676, __pyx_L3_error)
    __pyx_v_bnScale = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_bnScale == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1677, __pyx_L3_error)
    __pyx_v_bnBias = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_bnBias == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1677, __pyx_L3_error)
    __pyx_v_exponentialAverageFactor = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_exponentialAverageFactor == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1678, __pyx_L3_error)
    __pyx_v_resultRunningMean = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_resultRunningMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1679, __pyx_L3_error)
    __pyx_v_resultRunningVariance = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_resultRunningVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1679, __pyx_L3_error)
    __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1680, __pyx_L3_error)
    __pyx_v_resultSaveMean = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_resultSaveMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1680, __pyx_L3_error)
    __pyx_v_resultSaveInvVariance = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_resultSaveInvVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1680, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[22]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1683, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1683, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("batchNormalizationForwardTrainingEx", 1, 25, 25, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1670, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.batchNormalizationForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_150batchNormalizationForwardTrainingEx(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_zDesc, __pyx_v_z, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_exponentialAverageFactor, __pyx_v_resultRunningMean, __pyx_v_resultRunningVariance, __pyx_v_epsilon, __pyx_v_resultSaveMean, __pyx_v_resultSaveInvVariance, __pyx_v_activationDesc, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_150batchNormalizationForwardTrainingEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_alpha, size_t __pyx_v_beta, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_zDesc, size_t __pyx_v_z, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_bnScale, size_t __pyx_v_bnBias, double __pyx_v_exponentialAverageFactor, size_t __pyx_v_resultRunningMean, size_t __pyx_v_resultRunningVariance, double __pyx_v_epsilon, size_t __pyx_v_resultSaveMean, size_t __pyx_v_resultSaveInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationForwardTrainingEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTrainingEx(__pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_alpha, __pyx_v_beta, __pyx_v_xDesc, __pyx_v_x, __pyx_v_zDesc, __pyx_v_z, __pyx_v_yDesc, __pyx_v_y, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_bnScale, __pyx_v_bnBias, __pyx_v_exponentialAverageFactor, __pyx_v_resultRunningMean, __pyx_v_resultRunningVariance, __pyx_v_epsilon, __pyx_v_resultSaveMean, __pyx_v_resultSaveInvVariance, __pyx_v_activationDesc, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1670, __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.cuda.cudnn.batchNormalizationForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1703
 * 
 * 
 * cpdef size_t getBatchNormalizationForwardTrainingExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t xDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_153getBatchNormalizationForwardTrainingExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationForwardTrainingExWorkspaceSize(intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_zDesc, size_t __pyx_v_yDesc, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_activationDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationForwardTrainingExWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1711
 *         size_t activationDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle> handle,
 *         <BatchNormMode> mode, <BatchNormOps> bnOps,
 */
  __pyx_v_status = cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((cudnnBatchNormOps_t)__pyx_v_bnOps), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnTensorDescriptor_t)__pyx_v_zDesc), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((cudnnTensorDescriptor_t)__pyx_v_bnScaleBiasMeanVarDesc), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1720
 *         <ActivationDescriptor> activationDesc,
 *         &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1721
 *         &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1703
 * 
 * 
 * cpdef size_t getBatchNormalizationForwardTrainingExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t xDesc,
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_153getBatchNormalizationForwardTrainingExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_152getBatchNormalizationForwardTrainingExWorkspaceSize[] = "getBatchNormalizationForwardTrainingExWorkspaceSize(intptr_t handle, int mode, int bnOps, size_t xDesc, size_t zDesc, size_t yDesc, size_t bnScaleBiasMeanVarDesc, size_t activationDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_153getBatchNormalizationForwardTrainingExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  int __pyx_v_bnOps;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_zDesc;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_bnScaleBiasMeanVarDesc;
  size_t __pyx_v_activationDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBatchNormalizationForwardTrainingExWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_bnOps,&__pyx_n_s_xDesc,&__pyx_n_s_zDesc,&__pyx_n_s_yDesc,&__pyx_n_s_bnScaleBiasMeanVarDesc,&__pyx_n_s_activationDesc,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 1); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnOps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 2); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 3); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 4); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 5); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScaleBiasMeanVarDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 6); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, 7); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBatchNormalizationForwardTrainingExWorkspaceSize") < 0)) __PYX_ERR(0, 1703, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1704, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1704, __pyx_L3_error)
    __pyx_v_bnOps = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bnOps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1704, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1705, __pyx_L3_error)
    __pyx_v_zDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_zDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1707, __pyx_L3_error)
    __pyx_v_bnScaleBiasMeanVarDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_bnScaleBiasMeanVarDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1708, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1709, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getBatchNormalizationForwardTrainingExWorkspaceSize", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getBatchNormalizationForwardTrainingExWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_152getBatchNormalizationForwardTrainingExWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_xDesc, __pyx_v_zDesc, __pyx_v_yDesc, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_activationDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_152getBatchNormalizationForwardTrainingExWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_zDesc, size_t __pyx_v_yDesc, size_t __pyx_v_bnScaleBiasMeanVarDesc, size_t __pyx_v_activationDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationForwardTrainingExWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationForwardTrainingExWorkspaceSize(__pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_xDesc, __pyx_v_zDesc, __pyx_v_yDesc, __pyx_v_bnScaleBiasMeanVarDesc, __pyx_v_activationDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1703, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1724
 * 
 * 
 * cpdef batchNormalizationBackwardEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnops,
 *         size_t alphaDataDiff, size_t betaDataDiff,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_155batchNormalizationBackwardEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackwardEx(intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnops, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dzDesc, size_t __pyx_v_dz, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScaleData, size_t __pyx_v_bnBiasData, size_t __pyx_v_dBnScaleData, size_t __pyx_v_dBnBiasData, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationBackwardEx", 0);

  /* "cupy/cuda/cudnn.pyx":1741
 *         size_t workSpace, size_t workSpaceSizeInBytes,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnBatchNormalizationBackwardEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1742
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationBackwardEx(
 *             <Handle> handle,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1743
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnBatchNormalizationBackwardEx(             # <<<<<<<<<<<<<<
 *             <Handle> handle,
 *             <BatchNormMode> mode, <BatchNormOps> bnops,
 */
        __pyx_v_status = cudnnBatchNormalizationBackwardEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((cudnnBatchNormOps_t)__pyx_v_bnops), ((void *)__pyx_v_alphaDataDiff), ((void *)__pyx_v_betaDataDiff), ((void *)__pyx_v_alphaParamDiff), ((void *)__pyx_v_betaParamDiff), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnTensorDescriptor_t)__pyx_v_dzDesc), ((void *)__pyx_v_dz), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), ((cudnnTensorDescriptor_t)__pyx_v_dBnScaleBiasDesc), ((void *)__pyx_v_bnScaleData), ((void *)__pyx_v_bnBiasData), ((void *)__pyx_v_dBnScaleData), ((void *)__pyx_v_dBnBiasData), __pyx_v_epsilon, ((void *)__pyx_v_savedMean), ((void *)__pyx_v_savedInvVariance), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":1742
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnBatchNormalizationBackwardEx(
 *             <Handle> handle,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1761
 *             <void*> workSpace, workSpaceSizeInBytes,
 *             <void*> reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1724
 * 
 * 
 * cpdef batchNormalizationBackwardEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnops,
 *         size_t alphaDataDiff, size_t betaDataDiff,
 */

  /* 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.cuda.cudnn.batchNormalizationBackwardEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_155batchNormalizationBackwardEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_154batchNormalizationBackwardEx[] = "batchNormalizationBackwardEx(intptr_t handle, int mode, int bnops, size_t alphaDataDiff, size_t betaDataDiff, size_t alphaParamDiff, size_t betaParamDiff, size_t xDesc, size_t x, size_t yDesc, size_t y, size_t dyDesc, size_t dy, size_t dzDesc, size_t dz, size_t dxDesc, size_t dx, size_t dBnScaleBiasDesc, size_t bnScaleData, size_t bnBiasData, size_t dBnScaleData, size_t dBnBiasData, double epsilon, size_t savedMean, size_t savedInvVariance, size_t activationDesc, size_t workSpace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_155batchNormalizationBackwardEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  int __pyx_v_bnops;
  size_t __pyx_v_alphaDataDiff;
  size_t __pyx_v_betaDataDiff;
  size_t __pyx_v_alphaParamDiff;
  size_t __pyx_v_betaParamDiff;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_dzDesc;
  size_t __pyx_v_dz;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  size_t __pyx_v_dBnScaleBiasDesc;
  size_t __pyx_v_bnScaleData;
  size_t __pyx_v_bnBiasData;
  size_t __pyx_v_dBnScaleData;
  size_t __pyx_v_dBnBiasData;
  double __pyx_v_epsilon;
  size_t __pyx_v_savedMean;
  size_t __pyx_v_savedInvVariance;
  size_t __pyx_v_activationDesc;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("batchNormalizationBackwardEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_bnops,&__pyx_n_s_alphaDataDiff,&__pyx_n_s_betaDataDiff,&__pyx_n_s_alphaParamDiff,&__pyx_n_s_betaParamDiff,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_dzDesc,&__pyx_n_s_dz,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_dBnScaleBiasDesc,&__pyx_n_s_bnScaleData,&__pyx_n_s_bnBiasData,&__pyx_n_s_dBnScaleData,&__pyx_n_s_dBnBiasData,&__pyx_n_s_epsilon,&__pyx_n_s_savedMean,&__pyx_n_s_savedInvVariance,&__pyx_n_s_activationDesc,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[30] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 30: values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
        CYTHON_FALLTHROUGH;
        case 29: values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
        CYTHON_FALLTHROUGH;
        case 28: values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
        CYTHON_FALLTHROUGH;
        case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
        CYTHON_FALLTHROUGH;
        case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
        CYTHON_FALLTHROUGH;
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 1); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnops)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 2); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alphaDataDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 3); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_betaDataDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 4); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alphaParamDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 5); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_betaParamDiff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 6); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 7); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 8); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 9); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 10); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 11); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 12); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dzDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 13); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dz)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 14); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 15); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 16); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnScaleBiasDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 17); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnScaleData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 18); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnBiasData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 19); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnScaleData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 20); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnBiasData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 21); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 22); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_savedMean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 23); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_savedInvVariance)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 24); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 25:
        if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 25); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 26:
        if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 26); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 27:
        if (likely((values[27] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 27); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 28:
        if (likely((values[28] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 28); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 29:
        if (likely((values[29] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, 29); __PYX_ERR(0, 1724, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "batchNormalizationBackwardEx") < 0)) __PYX_ERR(0, 1724, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 30) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
      values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
      values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
      values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
      values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
      values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1725, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1725, __pyx_L3_error)
    __pyx_v_bnops = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bnops == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1725, __pyx_L3_error)
    __pyx_v_alphaDataDiff = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_alphaDataDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1726, __pyx_L3_error)
    __pyx_v_betaDataDiff = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_betaDataDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1726, __pyx_L3_error)
    __pyx_v_alphaParamDiff = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_alphaParamDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1727, __pyx_L3_error)
    __pyx_v_betaParamDiff = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_betaParamDiff == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1727, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1728, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1728, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1729, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1729, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1730, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1730, __pyx_L3_error)
    __pyx_v_dzDesc = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_dzDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error)
    __pyx_v_dz = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_dz == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1732, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1732, __pyx_L3_error)
    __pyx_v_dBnScaleBiasDesc = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_dBnScaleBiasDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1733, __pyx_L3_error)
    __pyx_v_bnScaleData = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_bnScaleData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L3_error)
    __pyx_v_bnBiasData = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_bnBiasData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L3_error)
    __pyx_v_dBnScaleData = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_dBnScaleData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1735, __pyx_L3_error)
    __pyx_v_dBnBiasData = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_dBnBiasData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1735, __pyx_L3_error)
    __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1736, __pyx_L3_error)
    __pyx_v_savedMean = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_savedMean == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L3_error)
    __pyx_v_savedInvVariance = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_savedInvVariance == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1737, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[25]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1738, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[26]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1739, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[27]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1739, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[28]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1740, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[29]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1740, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("batchNormalizationBackwardEx", 1, 30, 30, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1724, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.batchNormalizationBackwardEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_154batchNormalizationBackwardEx(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_bnops, __pyx_v_alphaDataDiff, __pyx_v_betaDataDiff, __pyx_v_alphaParamDiff, __pyx_v_betaParamDiff, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dzDesc, __pyx_v_dz, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dBnScaleBiasDesc, __pyx_v_bnScaleData, __pyx_v_bnBiasData, __pyx_v_dBnScaleData, __pyx_v_dBnBiasData, __pyx_v_epsilon, __pyx_v_savedMean, __pyx_v_savedInvVariance, __pyx_v_activationDesc, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_154batchNormalizationBackwardEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnops, size_t __pyx_v_alphaDataDiff, size_t __pyx_v_betaDataDiff, size_t __pyx_v_alphaParamDiff, size_t __pyx_v_betaParamDiff, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dzDesc, size_t __pyx_v_dz, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_bnScaleData, size_t __pyx_v_bnBiasData, size_t __pyx_v_dBnScaleData, size_t __pyx_v_dBnBiasData, double __pyx_v_epsilon, size_t __pyx_v_savedMean, size_t __pyx_v_savedInvVariance, size_t __pyx_v_activationDesc, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("batchNormalizationBackwardEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackwardEx(__pyx_v_handle, __pyx_v_mode, __pyx_v_bnops, __pyx_v_alphaDataDiff, __pyx_v_betaDataDiff, __pyx_v_alphaParamDiff, __pyx_v_betaParamDiff, __pyx_v_xDesc, __pyx_v_x, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dzDesc, __pyx_v_dz, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dBnScaleBiasDesc, __pyx_v_bnScaleData, __pyx_v_bnBiasData, __pyx_v_dBnScaleData, __pyx_v_dBnBiasData, __pyx_v_epsilon, __pyx_v_savedMean, __pyx_v_savedInvVariance, __pyx_v_activationDesc, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __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.cuda.cudnn.batchNormalizationBackwardEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1764
 * 
 * 
 * cpdef size_t getBatchNormalizationBackwardExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t xDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_157getBatchNormalizationBackwardExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationBackwardExWorkspaceSize(intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_yDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dzDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_activationDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationBackwardExWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1774
 *         size_t activationDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetBatchNormalizationBackwardExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle> handle,
 *         <BatchNormMode> mode,
 */
  __pyx_v_status = cudnnGetBatchNormalizationBackwardExWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((cudnnBatchNormOps_t)__pyx_v_bnOps), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((cudnnTensorDescriptor_t)__pyx_v_dzDesc), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((cudnnTensorDescriptor_t)__pyx_v_dBnScaleBiasDesc), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1786
 *         <ActivationDescriptor> activationDesc,
 *         &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1787
 *         &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1764
 * 
 * 
 * cpdef size_t getBatchNormalizationBackwardExWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t xDesc,
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_157getBatchNormalizationBackwardExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_156getBatchNormalizationBackwardExWorkspaceSize[] = "getBatchNormalizationBackwardExWorkspaceSize(intptr_t handle, int mode, int bnOps, size_t xDesc, size_t yDesc, size_t dyDesc, size_t dzDesc, size_t dxDesc, size_t dBnScaleBiasDesc, size_t activationDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_157getBatchNormalizationBackwardExWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  int __pyx_v_bnOps;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dzDesc;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dBnScaleBiasDesc;
  size_t __pyx_v_activationDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBatchNormalizationBackwardExWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_bnOps,&__pyx_n_s_xDesc,&__pyx_n_s_yDesc,&__pyx_n_s_dyDesc,&__pyx_n_s_dzDesc,&__pyx_n_s_dxDesc,&__pyx_n_s_dBnScaleBiasDesc,&__pyx_n_s_activationDesc,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 1); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnOps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 2); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 3); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 4); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 5); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dzDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 6); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 7); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dBnScaleBiasDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 8); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, 9); __PYX_ERR(0, 1764, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBatchNormalizationBackwardExWorkspaceSize") < 0)) __PYX_ERR(0, 1764, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1765, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1765, __pyx_L3_error)
    __pyx_v_bnOps = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bnOps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1765, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1766, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1767, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1768, __pyx_L3_error)
    __pyx_v_dzDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dzDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1769, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1770, __pyx_L3_error)
    __pyx_v_dBnScaleBiasDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_dBnScaleBiasDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1771, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1772, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getBatchNormalizationBackwardExWorkspaceSize", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1764, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getBatchNormalizationBackwardExWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_156getBatchNormalizationBackwardExWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_xDesc, __pyx_v_yDesc, __pyx_v_dyDesc, __pyx_v_dzDesc, __pyx_v_dxDesc, __pyx_v_dBnScaleBiasDesc, __pyx_v_activationDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_156getBatchNormalizationBackwardExWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_xDesc, size_t __pyx_v_yDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dzDesc, size_t __pyx_v_dxDesc, size_t __pyx_v_dBnScaleBiasDesc, size_t __pyx_v_activationDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationBackwardExWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationBackwardExWorkspaceSize(__pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_xDesc, __pyx_v_yDesc, __pyx_v_dyDesc, __pyx_v_dzDesc, __pyx_v_dxDesc, __pyx_v_dBnScaleBiasDesc, __pyx_v_activationDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1764, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1790
 * 
 * 
 * cpdef size_t getBatchNormalizationTrainingExReserveSpaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t activationDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_159getBatchNormalizationTrainingExReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationTrainingExReserveSpaceSize(intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_activationDesc, size_t __pyx_v_xDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationTrainingExReserveSpaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1795
 *         size_t xDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetBatchNormalizationTrainingExReserveSpaceSize(             # <<<<<<<<<<<<<<
 *         <Handle> handle,
 *         <BatchNormMode> mode,
 */
  __pyx_v_status = cudnnGetBatchNormalizationTrainingExReserveSpaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnBatchNormMode_t)__pyx_v_mode), ((cudnnBatchNormOps_t)__pyx_v_bnOps), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1802
 *         <TensorDescriptor> xDesc,
 *         &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1803
 *         &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1790
 * 
 * 
 * cpdef size_t getBatchNormalizationTrainingExReserveSpaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int mode, int bnOps,
 *         size_t activationDesc,
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_159getBatchNormalizationTrainingExReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_158getBatchNormalizationTrainingExReserveSpaceSize[] = "getBatchNormalizationTrainingExReserveSpaceSize(intptr_t handle, int mode, int bnOps, size_t activationDesc, size_t xDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_159getBatchNormalizationTrainingExReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_mode;
  int __pyx_v_bnOps;
  size_t __pyx_v_activationDesc;
  size_t __pyx_v_xDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getBatchNormalizationTrainingExReserveSpaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_mode,&__pyx_n_s_bnOps,&__pyx_n_s_activationDesc,&__pyx_n_s_xDesc,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationTrainingExReserveSpaceSize", 1, 5, 5, 1); __PYX_ERR(0, 1790, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnOps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationTrainingExReserveSpaceSize", 1, 5, 5, 2); __PYX_ERR(0, 1790, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationTrainingExReserveSpaceSize", 1, 5, 5, 3); __PYX_ERR(0, 1790, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getBatchNormalizationTrainingExReserveSpaceSize", 1, 5, 5, 4); __PYX_ERR(0, 1790, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBatchNormalizationTrainingExReserveSpaceSize") < 0)) __PYX_ERR(0, 1790, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1791, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1791, __pyx_L3_error)
    __pyx_v_bnOps = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bnOps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1791, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1792, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1793, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getBatchNormalizationTrainingExReserveSpaceSize", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1790, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getBatchNormalizationTrainingExReserveSpaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_158getBatchNormalizationTrainingExReserveSpaceSize(__pyx_self, __pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_activationDesc, __pyx_v_xDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_158getBatchNormalizationTrainingExReserveSpaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_mode, int __pyx_v_bnOps, size_t __pyx_v_activationDesc, size_t __pyx_v_xDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getBatchNormalizationTrainingExReserveSpaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationTrainingExReserveSpaceSize(__pyx_v_handle, __pyx_v_mode, __pyx_v_bnOps, __pyx_v_activationDesc, __pyx_v_xDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1790, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1810
 * ###############################################################################
 * 
 * cpdef size_t createActivationDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ActivationDescriptor activationDesc
 *     status = cudnnCreateActivationDescriptor(&activationDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_161createActivationDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createActivationDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnActivationDescriptor_t __pyx_v_activationDesc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createActivationDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1812
 * cpdef size_t createActivationDescriptor() except? 0:
 *     cdef ActivationDescriptor activationDesc
 *     status = cudnnCreateActivationDescriptor(&activationDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>activationDesc
 */
  __pyx_v_status = cudnnCreateActivationDescriptor((&__pyx_v_activationDesc));

  /* "cupy/cuda/cudnn.pyx":1813
 *     cdef ActivationDescriptor activationDesc
 *     status = cudnnCreateActivationDescriptor(&activationDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>activationDesc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1814
 *     status = cudnnCreateActivationDescriptor(&activationDesc)
 *     check_status(status)
 *     return <size_t>activationDesc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_activationDesc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1810
 * ###############################################################################
 * 
 * cpdef size_t createActivationDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef ActivationDescriptor activationDesc
 *     status = cudnnCreateActivationDescriptor(&activationDesc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_161createActivationDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_160createActivationDescriptor[] = "createActivationDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_161createActivationDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createActivationDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_160createActivationDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_160createActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createActivationDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createActivationDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1810, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1817
 * 
 * 
 * cpdef setActivationDescriptor(             # <<<<<<<<<<<<<<
 *         size_t activationDesc, int mode, int reluNanOpt, double reluCeiling):
 *     status = cudnnSetActivationDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_163setActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setActivationDescriptor(size_t __pyx_v_activationDesc, int __pyx_v_mode, int __pyx_v_reluNanOpt, double __pyx_v_reluCeiling, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setActivationDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1819
 * cpdef setActivationDescriptor(
 *         size_t activationDesc, int mode, int reluNanOpt, double reluCeiling):
 *     status = cudnnSetActivationDescriptor(             # <<<<<<<<<<<<<<
 *         <ActivationDescriptor>activationDesc, <ActivationMode>mode,
 *         <NanPropagation>reluNanOpt, reluCeiling)
 */
  __pyx_v_status = cudnnSetActivationDescriptor(((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((cudnnActivationMode_t)__pyx_v_mode), ((cudnnNanPropagation_t)__pyx_v_reluNanOpt), __pyx_v_reluCeiling);

  /* "cupy/cuda/cudnn.pyx":1822
 *         <ActivationDescriptor>activationDesc, <ActivationMode>mode,
 *         <NanPropagation>reluNanOpt, reluCeiling)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1817
 * 
 * 
 * cpdef setActivationDescriptor(             # <<<<<<<<<<<<<<
 *         size_t activationDesc, int mode, int reluNanOpt, double reluCeiling):
 *     status = cudnnSetActivationDescriptor(
 */

  /* 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.cuda.cudnn.setActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_163setActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_162setActivationDescriptor[] = "setActivationDescriptor(size_t activationDesc, int mode, int reluNanOpt, double reluCeiling)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_163setActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_activationDesc;
  int __pyx_v_mode;
  int __pyx_v_reluNanOpt;
  double __pyx_v_reluCeiling;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setActivationDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_activationDesc,&__pyx_n_s_mode,&__pyx_n_s_reluNanOpt,&__pyx_n_s_reluCeiling,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setActivationDescriptor", 1, 4, 4, 1); __PYX_ERR(0, 1817, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reluNanOpt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setActivationDescriptor", 1, 4, 4, 2); __PYX_ERR(0, 1817, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reluCeiling)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setActivationDescriptor", 1, 4, 4, 3); __PYX_ERR(0, 1817, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setActivationDescriptor") < 0)) __PYX_ERR(0, 1817, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L3_error)
    __pyx_v_reluNanOpt = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_reluNanOpt == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L3_error)
    __pyx_v_reluCeiling = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_reluCeiling == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setActivationDescriptor", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1817, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_162setActivationDescriptor(__pyx_self, __pyx_v_activationDesc, __pyx_v_mode, __pyx_v_reluNanOpt, __pyx_v_reluCeiling);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_162setActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_activationDesc, int __pyx_v_mode, int __pyx_v_reluNanOpt, double __pyx_v_reluCeiling) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setActivationDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setActivationDescriptor(__pyx_v_activationDesc, __pyx_v_mode, __pyx_v_reluNanOpt, __pyx_v_reluCeiling, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1817, __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.cuda.cudnn.setActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1825
 * 
 * 
 * cpdef destroyActivationDescriptor(size_t activationDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyActivationDescriptor(
 *         <ActivationDescriptor>activationDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_165destroyActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_activationDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyActivationDescriptor(size_t __pyx_v_activationDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyActivationDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1826
 * 
 * cpdef destroyActivationDescriptor(size_t activationDesc):
 *     status = cudnnDestroyActivationDescriptor(             # <<<<<<<<<<<<<<
 *         <ActivationDescriptor>activationDesc)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDestroyActivationDescriptor(((cudnnActivationDescriptor_t)__pyx_v_activationDesc));

  /* "cupy/cuda/cudnn.pyx":1828
 *     status = cudnnDestroyActivationDescriptor(
 *         <ActivationDescriptor>activationDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1825
 * 
 * 
 * cpdef destroyActivationDescriptor(size_t activationDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyActivationDescriptor(
 *         <ActivationDescriptor>activationDesc)
 */

  /* 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.cuda.cudnn.destroyActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_165destroyActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_activationDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_164destroyActivationDescriptor[] = "destroyActivationDescriptor(size_t activationDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_165destroyActivationDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_activationDesc) {
  size_t __pyx_v_activationDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyActivationDescriptor (wrapper)", 0);
  assert(__pyx_arg_activationDesc); {
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(__pyx_arg_activationDesc); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_164destroyActivationDescriptor(__pyx_self, ((size_t)__pyx_v_activationDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_164destroyActivationDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_activationDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyActivationDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyActivationDescriptor(__pyx_v_activationDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1825, __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.cuda.cudnn.destroyActivationDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1831
 * 
 * 
 * cpdef softmaxForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_167softmaxForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_softmaxForward(intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("softmaxForward", 0);

  /* "cupy/cuda/cudnn.pyx":1834
 *         intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSoftmaxForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1835
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSoftmaxForward(
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1836
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSoftmaxForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 *             <void*>alpha, <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnSoftmaxForward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSoftmaxAlgorithm_t)__pyx_v_algorithm), ((cudnnSoftmaxMode_t)__pyx_v_mode), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_dstDesc), ((void *)__pyx_v_dstData));
      }

      /* "cupy/cuda/cudnn.pyx":1835
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSoftmaxForward(
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1840
 *             <void*>alpha, <TensorDescriptor>srcDesc, <void*>srcData,
 *             <void*>beta, <TensorDescriptor>dstDesc, <void*>dstData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1831
 * 
 * 
 * cpdef softmaxForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

  /* 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.cuda.cudnn.softmaxForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_167softmaxForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_166softmaxForward[] = "softmaxForward(intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc, size_t srcData, size_t beta, size_t dstDesc, size_t dstData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_167softmaxForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_algorithm;
  int __pyx_v_mode;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_beta;
  size_t __pyx_v_dstDesc;
  size_t __pyx_v_dstData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("softmaxForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_algorithm,&__pyx_n_s_mode,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_beta,&__pyx_n_s_dstDesc,&__pyx_n_s_dstData,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algorithm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 1); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 2); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 3); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 4); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 5); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 6); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 7); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, 8); __PYX_ERR(0, 1831, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "softmaxForward") < 0)) __PYX_ERR(0, 1831, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L3_error)
    __pyx_v_algorithm = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_algorithm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1832, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
    __pyx_v_dstDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dstDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
    __pyx_v_dstData = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_dstData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1833, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("softmaxForward", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1831, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.softmaxForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_166softmaxForward(__pyx_self, __pyx_v_handle, __pyx_v_algorithm, __pyx_v_mode, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_166softmaxForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("softmaxForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_softmaxForward(__pyx_v_handle, __pyx_v_algorithm, __pyx_v_mode, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1831, __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.cuda.cudnn.softmaxForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1843
 * 
 * 
 * cpdef softmaxBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t beta,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_169softmaxBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_softmaxBackward(intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("softmaxBackward", 0);

  /* "cupy/cuda/cudnn.pyx":1847
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t beta,
 *         size_t destDiffDesc, size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSoftmaxBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1848
 *         size_t destDiffDesc, size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSoftmaxBackward(
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1849
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSoftmaxBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 *             <void*>alpha, <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnSoftmaxBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSoftmaxAlgorithm_t)__pyx_v_algorithm), ((cudnnSoftmaxMode_t)__pyx_v_mode), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnTensorDescriptor_t)__pyx_v_srcDiffDesc), ((void *)__pyx_v_srcDiffData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_destDiffDesc), ((void *)__pyx_v_destDiffData));
      }

      /* "cupy/cuda/cudnn.pyx":1848
 *         size_t destDiffDesc, size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSoftmaxBackward(
 *             <Handle>handle, <SoftmaxAlgorithm>algorithm, <SoftmaxMode>mode,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1854
 *             <TensorDescriptor>srcDiffDesc, <void*>srcDiffData, <void*>beta,
 *             <TensorDescriptor>destDiffDesc, <void*>destDiffData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1843
 * 
 * 
 * cpdef softmaxBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t beta,
 */

  /* 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.cuda.cudnn.softmaxBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_169softmaxBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_168softmaxBackward[] = "softmaxBackward(intptr_t handle, int algorithm, int mode, size_t alpha, size_t srcDesc, size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t beta, size_t destDiffDesc, size_t destDiffData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_169softmaxBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  int __pyx_v_algorithm;
  int __pyx_v_mode;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_srcDiffDesc;
  size_t __pyx_v_srcDiffData;
  size_t __pyx_v_beta;
  size_t __pyx_v_destDiffDesc;
  size_t __pyx_v_destDiffData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("softmaxBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_algorithm,&__pyx_n_s_mode,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_srcDiffDesc,&__pyx_n_s_srcDiffData,&__pyx_n_s_beta,&__pyx_n_s_destDiffDesc,&__pyx_n_s_destDiffData,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algorithm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 1); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 2); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 3); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 4); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 5); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 6); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 7); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 8); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 9); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, 10); __PYX_ERR(0, 1843, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "softmaxBackward") < 0)) __PYX_ERR(0, 1843, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1844, __pyx_L3_error)
    __pyx_v_algorithm = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_algorithm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1844, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1844, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1844, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1844, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1845, __pyx_L3_error)
    __pyx_v_srcDiffDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_srcDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1845, __pyx_L3_error)
    __pyx_v_srcDiffData = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_srcDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1845, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1845, __pyx_L3_error)
    __pyx_v_destDiffDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_destDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1846, __pyx_L3_error)
    __pyx_v_destDiffData = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_destDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1846, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("softmaxBackward", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.softmaxBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_168softmaxBackward(__pyx_self, __pyx_v_handle, __pyx_v_algorithm, __pyx_v_mode, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_168softmaxBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, int __pyx_v_algorithm, int __pyx_v_mode, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("softmaxBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_softmaxBackward(__pyx_v_handle, __pyx_v_algorithm, __pyx_v_mode, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1843, __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.cuda.cudnn.softmaxBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1857
 * 
 * 
 * cpdef activationForward_v4(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_171activationForward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_activationForward_v4(intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("activationForward_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1860
 *         intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnActivationForward_v4(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1861
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnActivationForward_v4(
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1862
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnActivationForward_v4(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 */
        __pyx_v_status = cudnnActivationForward_v4(((cudnnHandle_t)__pyx_v_handle), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_dstDesc), ((void *)__pyx_v_dstData));
      }

      /* "cupy/cuda/cudnn.pyx":1861
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnActivationForward_v4(
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1866
 *             <TensorDescriptor>srcDesc, <void*>srcData, <void*>beta,
 *             <TensorDescriptor>dstDesc, <void*>dstData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1857
 * 
 * 
 * cpdef activationForward_v4(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t beta, size_t dstDesc, size_t dstData):
 */

  /* 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.cuda.cudnn.activationForward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_171activationForward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_170activationForward_v4[] = "activationForward_v4(intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc, size_t srcData, size_t beta, size_t dstDesc, size_t dstData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_171activationForward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_activationDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_beta;
  size_t __pyx_v_dstDesc;
  size_t __pyx_v_dstData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("activationForward_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_activationDesc,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_beta,&__pyx_n_s_dstDesc,&__pyx_n_s_dstData,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 1); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 2); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 3); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 4); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 5); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 6); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, 7); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "activationForward_v4") < 0)) __PYX_ERR(0, 1857, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1858, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1858, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1858, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1858, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
    __pyx_v_dstDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dstDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
    __pyx_v_dstData = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dstData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("activationForward_v4", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1857, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.activationForward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_170activationForward_v4(__pyx_self, __pyx_v_handle, __pyx_v_activationDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_170activationForward_v4(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_beta, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("activationForward_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_activationForward_v4(__pyx_v_handle, __pyx_v_activationDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_beta, __pyx_v_dstDesc, __pyx_v_dstData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __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.cuda.cudnn.activationForward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1869
 * 
 * 
 * cpdef activationBackward_v4(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_173activationBackward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_activationBackward_v4(intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("activationBackward_v4", 0);

  /* "cupy/cuda/cudnn.pyx":1874
 *         size_t destDesc, size_t destData, size_t beta, size_t destDiffDesc,
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnActivationBackward_v4(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1875
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnActivationBackward_v4(
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1876
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnActivationBackward_v4(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 *             <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnActivationBackward_v4(((cudnnHandle_t)__pyx_v_handle), ((cudnnActivationDescriptor_t)__pyx_v_activationDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnTensorDescriptor_t)__pyx_v_srcDiffDesc), ((void *)__pyx_v_srcDiffData), ((cudnnTensorDescriptor_t)__pyx_v_destDesc), ((void *)__pyx_v_destData), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_destDiffDesc), ((void *)__pyx_v_destDiffData));
      }

      /* "cupy/cuda/cudnn.pyx":1875
 *         size_t destDiffData):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnActivationBackward_v4(
 *             <Handle>handle, <ActivationDescriptor>activationDesc, <void*>alpha,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1882
 *             <TensorDescriptor>destDesc, <void*>destData, <void*>beta,
 *             <TensorDescriptor>destDiffDesc, <void*>destDiffData)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1869
 * 
 * 
 * cpdef activationBackward_v4(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc,
 *         size_t srcData, size_t srcDiffDesc, size_t srcDiffData,
 */

  /* 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.cuda.cudnn.activationBackward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_173activationBackward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_172activationBackward_v4[] = "activationBackward_v4(intptr_t handle, size_t activationDesc, size_t alpha, size_t srcDesc, size_t srcData, size_t srcDiffDesc, size_t srcDiffData, size_t destDesc, size_t destData, size_t beta, size_t destDiffDesc, size_t destDiffData)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_173activationBackward_v4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_activationDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_srcDiffDesc;
  size_t __pyx_v_srcDiffData;
  size_t __pyx_v_destDesc;
  size_t __pyx_v_destData;
  size_t __pyx_v_beta;
  size_t __pyx_v_destDiffDesc;
  size_t __pyx_v_destDiffData;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("activationBackward_v4 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_activationDesc,&__pyx_n_s_alpha,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_srcDiffDesc,&__pyx_n_s_srcDiffData,&__pyx_n_s_destDesc,&__pyx_n_s_destData,&__pyx_n_s_beta,&__pyx_n_s_destDiffDesc,&__pyx_n_s_destDiffData,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activationDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 1); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 2); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 3); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 4); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 5); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 6); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 7); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 8); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 9); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 10); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destDiffData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, 11); __PYX_ERR(0, 1869, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "activationBackward_v4") < 0)) __PYX_ERR(0, 1869, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    __pyx_v_activationDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_activationDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1871, __pyx_L3_error)
    __pyx_v_srcDiffDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_srcDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1871, __pyx_L3_error)
    __pyx_v_srcDiffData = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_srcDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1871, __pyx_L3_error)
    __pyx_v_destDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_destDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L3_error)
    __pyx_v_destData = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_destData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L3_error)
    __pyx_v_destDiffDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_destDiffDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L3_error)
    __pyx_v_destDiffData = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_destDiffData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1873, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("activationBackward_v4", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1869, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.activationBackward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_172activationBackward_v4(__pyx_self, __pyx_v_handle, __pyx_v_activationDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_destDesc, __pyx_v_destData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_172activationBackward_v4(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_activationDesc, size_t __pyx_v_alpha, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_srcDiffDesc, size_t __pyx_v_srcDiffData, size_t __pyx_v_destDesc, size_t __pyx_v_destData, size_t __pyx_v_beta, size_t __pyx_v_destDiffDesc, size_t __pyx_v_destDiffData) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("activationBackward_v4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_activationBackward_v4(__pyx_v_handle, __pyx_v_activationDesc, __pyx_v_alpha, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_srcDiffDesc, __pyx_v_srcDiffData, __pyx_v_destDesc, __pyx_v_destData, __pyx_v_beta, __pyx_v_destDiffDesc, __pyx_v_destDiffData, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1869, __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.cuda.cudnn.activationBackward_v4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1889
 * ###############################################################################
 * 
 * cpdef size_t createDropoutDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef DropoutDescriptor desc
 *     status = cudnnCreateDropoutDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_175createDropoutDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createDropoutDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnDropoutDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createDropoutDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1891
 * cpdef size_t createDropoutDescriptor() except? 0:
 *     cdef DropoutDescriptor desc
 *     status = cudnnCreateDropoutDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateDropoutDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":1892
 *     cdef DropoutDescriptor desc
 *     status = cudnnCreateDropoutDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1893
 *     status = cudnnCreateDropoutDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1889
 * ###############################################################################
 * 
 * cpdef size_t createDropoutDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef DropoutDescriptor desc
 *     status = cudnnCreateDropoutDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_175createDropoutDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_174createDropoutDescriptor[] = "createDropoutDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_175createDropoutDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createDropoutDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_174createDropoutDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_174createDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createDropoutDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createDropoutDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1889, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1896
 * 
 * 
 * cpdef destroyDropoutDescriptor(size_t dropoutDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyDropoutDescriptor(<DropoutDescriptor>dropoutDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_177destroyDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_dropoutDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyDropoutDescriptor(size_t __pyx_v_dropoutDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyDropoutDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1897
 * 
 * cpdef destroyDropoutDescriptor(size_t dropoutDesc):
 *     status = cudnnDestroyDropoutDescriptor(<DropoutDescriptor>dropoutDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyDropoutDescriptor(((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc));

  /* "cupy/cuda/cudnn.pyx":1898
 * cpdef destroyDropoutDescriptor(size_t dropoutDesc):
 *     status = cudnnDestroyDropoutDescriptor(<DropoutDescriptor>dropoutDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1896
 * 
 * 
 * cpdef destroyDropoutDescriptor(size_t dropoutDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyDropoutDescriptor(<DropoutDescriptor>dropoutDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_177destroyDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_dropoutDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_176destroyDropoutDescriptor[] = "destroyDropoutDescriptor(size_t dropoutDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_177destroyDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_dropoutDesc) {
  size_t __pyx_v_dropoutDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyDropoutDescriptor (wrapper)", 0);
  assert(__pyx_arg_dropoutDesc); {
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(__pyx_arg_dropoutDesc); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1896, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_176destroyDropoutDescriptor(__pyx_self, ((size_t)__pyx_v_dropoutDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_176destroyDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_dropoutDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyDropoutDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyDropoutDescriptor(__pyx_v_dropoutDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1896, __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.cuda.cudnn.destroyDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1901
 * 
 * 
 * cpdef Py_ssize_t dropoutGetStatesSize(intptr_t handle) except? -1:             # <<<<<<<<<<<<<<
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetStatesSize(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_179dropoutGetStatesSize(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static Py_ssize_t __pyx_f_4cupy_4cuda_5cudnn_dropoutGetStatesSize(intptr_t __pyx_v_handle, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("dropoutGetStatesSize", 0);

  /* "cupy/cuda/cudnn.pyx":1903
 * cpdef Py_ssize_t dropoutGetStatesSize(intptr_t handle) except? -1:
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetStatesSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, &sizeInBytes)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDropoutGetStatesSize(((cudnnHandle_t)__pyx_v_handle), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1905
 *     status = cudnnDropoutGetStatesSize(
 *         <Handle>handle, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <Py_ssize_t>sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1906
 *         <Handle>handle, &sizeInBytes)
 *     check_status(status)
 *     return <Py_ssize_t>sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((Py_ssize_t)__pyx_v_sizeInBytes);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1901
 * 
 * 
 * cpdef Py_ssize_t dropoutGetStatesSize(intptr_t handle) except? -1:             # <<<<<<<<<<<<<<
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetStatesSize(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cupy.cuda.cudnn.dropoutGetStatesSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_179dropoutGetStatesSize(PyObject *__pyx_self, PyObject *__pyx_arg_handle); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_178dropoutGetStatesSize[] = "dropoutGetStatesSize(intptr_t handle) -> Py_ssize_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_179dropoutGetStatesSize(PyObject *__pyx_self, PyObject *__pyx_arg_handle) {
  intptr_t __pyx_v_handle;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dropoutGetStatesSize (wrapper)", 0);
  assert(__pyx_arg_handle); {
    __pyx_v_handle = PyInt_AsSsize_t(__pyx_arg_handle); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1901, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.dropoutGetStatesSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_178dropoutGetStatesSize(__pyx_self, ((intptr_t)__pyx_v_handle));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_178dropoutGetStatesSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("dropoutGetStatesSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_dropoutGetStatesSize(__pyx_v_handle, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L) && PyErr_Occurred())) __PYX_ERR(0, 1901, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1909
 * 
 * 
 * cpdef setDropoutDescriptor(             # <<<<<<<<<<<<<<
 *         size_t dropoutDesc, intptr_t handle, float dropout,
 *         size_t states, size_t stateSizeInBytes, unsigned long long seed):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_181setDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setDropoutDescriptor(size_t __pyx_v_dropoutDesc, intptr_t __pyx_v_handle, float __pyx_v_dropout, size_t __pyx_v_states, size_t __pyx_v_stateSizeInBytes, unsigned PY_LONG_LONG __pyx_v_seed, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setDropoutDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1912
 *         size_t dropoutDesc, intptr_t handle, float dropout,
 *         size_t states, size_t stateSizeInBytes, unsigned long long seed):
 *     status = cudnnSetDropoutDescriptor(             # <<<<<<<<<<<<<<
 *         <DropoutDescriptor>dropoutDesc, <Handle>handle, dropout,
 *         <void*>states, stateSizeInBytes, seed)
 */
  __pyx_v_status = cudnnSetDropoutDescriptor(((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc), ((cudnnHandle_t)__pyx_v_handle), __pyx_v_dropout, ((void *)__pyx_v_states), __pyx_v_stateSizeInBytes, __pyx_v_seed);

  /* "cupy/cuda/cudnn.pyx":1915
 *         <DropoutDescriptor>dropoutDesc, <Handle>handle, dropout,
 *         <void*>states, stateSizeInBytes, seed)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1909
 * 
 * 
 * cpdef setDropoutDescriptor(             # <<<<<<<<<<<<<<
 *         size_t dropoutDesc, intptr_t handle, float dropout,
 *         size_t states, size_t stateSizeInBytes, unsigned long long seed):
 */

  /* 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.cuda.cudnn.setDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_181setDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_180setDropoutDescriptor[] = "setDropoutDescriptor(size_t dropoutDesc, intptr_t handle, float dropout, size_t states, size_t stateSizeInBytes, unsigned long long seed)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_181setDropoutDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_dropoutDesc;
  intptr_t __pyx_v_handle;
  float __pyx_v_dropout;
  size_t __pyx_v_states;
  size_t __pyx_v_stateSizeInBytes;
  unsigned PY_LONG_LONG __pyx_v_seed;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setDropoutDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dropoutDesc,&__pyx_n_s_handle,&__pyx_n_s_dropout,&__pyx_n_s_states,&__pyx_n_s_stateSizeInBytes,&__pyx_n_s_seed,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropoutDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, 1); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, 2); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_states)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, 3); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stateSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, 4); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, 5); __PYX_ERR(0, 1909, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDropoutDescriptor") < 0)) __PYX_ERR(0, 1909, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1910, __pyx_L3_error)
    __pyx_v_handle = PyInt_AsSsize_t(values[1]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1910, __pyx_L3_error)
    __pyx_v_dropout = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_dropout == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1910, __pyx_L3_error)
    __pyx_v_states = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_states == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1911, __pyx_L3_error)
    __pyx_v_stateSizeInBytes = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_stateSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1911, __pyx_L3_error)
    __pyx_v_seed = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[5]); if (unlikely((__pyx_v_seed == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 1911, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setDropoutDescriptor", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1909, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_180setDropoutDescriptor(__pyx_self, __pyx_v_dropoutDesc, __pyx_v_handle, __pyx_v_dropout, __pyx_v_states, __pyx_v_stateSizeInBytes, __pyx_v_seed);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_180setDropoutDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_dropoutDesc, intptr_t __pyx_v_handle, float __pyx_v_dropout, size_t __pyx_v_states, size_t __pyx_v_stateSizeInBytes, unsigned PY_LONG_LONG __pyx_v_seed) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setDropoutDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setDropoutDescriptor(__pyx_v_dropoutDesc, __pyx_v_handle, __pyx_v_dropout, __pyx_v_states, __pyx_v_stateSizeInBytes, __pyx_v_seed, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1909, __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.cuda.cudnn.setDropoutDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1918
 * 
 * 
 * cpdef size_t getDropoutReserveSpaceSize(size_t xDesc) except? 0:             # <<<<<<<<<<<<<<
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetReserveSpaceSize(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_183getDropoutReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_arg_xDesc); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getDropoutReserveSpaceSize(size_t __pyx_v_xDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getDropoutReserveSpaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1920
 * cpdef size_t getDropoutReserveSpaceSize(size_t xDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetReserveSpaceSize(             # <<<<<<<<<<<<<<
 *         <TensorDescriptor>xDesc, &sizeInBytes)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDropoutGetReserveSpaceSize(((cudnnTensorDescriptor_t)__pyx_v_xDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1922
 *     status = cudnnDropoutGetReserveSpaceSize(
 *         <TensorDescriptor>xDesc, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1923
 *         <TensorDescriptor>xDesc, &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1918
 * 
 * 
 * cpdef size_t getDropoutReserveSpaceSize(size_t xDesc) except? 0:             # <<<<<<<<<<<<<<
 *     cdef size_t sizeInBytes
 *     status = cudnnDropoutGetReserveSpaceSize(
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_183getDropoutReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_arg_xDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_182getDropoutReserveSpaceSize[] = "getDropoutReserveSpaceSize(size_t xDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_183getDropoutReserveSpaceSize(PyObject *__pyx_self, PyObject *__pyx_arg_xDesc) {
  size_t __pyx_v_xDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getDropoutReserveSpaceSize (wrapper)", 0);
  assert(__pyx_arg_xDesc); {
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(__pyx_arg_xDesc); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1918, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getDropoutReserveSpaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_182getDropoutReserveSpaceSize(__pyx_self, ((size_t)__pyx_v_xDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_182getDropoutReserveSpaceSize(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_xDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getDropoutReserveSpaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getDropoutReserveSpaceSize(__pyx_v_xDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1918, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1926
 * 
 * 
 * cpdef dropoutForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t dropoutDesc,
 *         size_t srcDesc, size_t srcData,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_185dropoutForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_dropoutForward(intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("dropoutForward", 0);

  /* "cupy/cuda/cudnn.pyx":1931
 *         size_t dstDesc, size_t dstData,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDropoutForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1932
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDropoutForward(
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1933
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnDropoutForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 *             <TensorDescriptor>srcDesc, <void*>srcData,
 */
        __pyx_v_status = cudnnDropoutForward(((cudnnHandle_t)__pyx_v_handle), ((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc), ((cudnnTensorDescriptor_t)__pyx_v_srcDesc), ((void *)__pyx_v_srcData), ((cudnnTensorDescriptor_t)__pyx_v_dstDesc), ((void *)__pyx_v_dstData), ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":1932
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDropoutForward(
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1938
 *             <TensorDescriptor>dstDesc, <void*>dstData,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1926
 * 
 * 
 * cpdef dropoutForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t dropoutDesc,
 *         size_t srcDesc, size_t srcData,
 */

  /* 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.cuda.cudnn.dropoutForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_185dropoutForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_184dropoutForward[] = "dropoutForward(intptr_t handle, size_t dropoutDesc, size_t srcDesc, size_t srcData, size_t dstDesc, size_t dstData, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_185dropoutForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_dropoutDesc;
  size_t __pyx_v_srcDesc;
  size_t __pyx_v_srcData;
  size_t __pyx_v_dstDesc;
  size_t __pyx_v_dstData;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dropoutForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_dropoutDesc,&__pyx_n_s_srcDesc,&__pyx_n_s_srcData,&__pyx_n_s_dstDesc,&__pyx_n_s_dstData,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropoutDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 1); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 2); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 3); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 4); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 5); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 6); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, 7); __PYX_ERR(0, 1926, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dropoutForward") < 0)) __PYX_ERR(0, 1926, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error)
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1927, __pyx_L3_error)
    __pyx_v_srcDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_srcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1928, __pyx_L3_error)
    __pyx_v_srcData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_srcData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1928, __pyx_L3_error)
    __pyx_v_dstDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dstDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1929, __pyx_L3_error)
    __pyx_v_dstData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_dstData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1929, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1930, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1930, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dropoutForward", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.dropoutForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_184dropoutForward(__pyx_self, __pyx_v_handle, __pyx_v_dropoutDesc, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_dstDesc, __pyx_v_dstData, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_184dropoutForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_srcDesc, size_t __pyx_v_srcData, size_t __pyx_v_dstDesc, size_t __pyx_v_dstData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("dropoutForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_dropoutForward(__pyx_v_handle, __pyx_v_dropoutDesc, __pyx_v_srcDesc, __pyx_v_srcData, __pyx_v_dstDesc, __pyx_v_dstData, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1926, __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.cuda.cudnn.dropoutForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1941
 * 
 * 
 * cpdef dropoutBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t dropoutDesc,
 *         size_t dyDesc, size_t dyData,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_187dropoutBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_dropoutBackward(intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dyData, size_t __pyx_v_dxDesc, size_t __pyx_v_dxData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("dropoutBackward", 0);

  /* "cupy/cuda/cudnn.pyx":1946
 *         size_t dxDesc, size_t dxData,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDropoutBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1947
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDropoutBackward(
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":1948
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnDropoutBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 *             <TensorDescriptor>dyDesc, <void*>dyData,
 */
        __pyx_v_status = cudnnDropoutBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dyData), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dxData), ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":1947
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDropoutBackward(
 *             <Handle>handle, <DropoutDescriptor>dropoutDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":1953
 *             <TensorDescriptor>dxDesc, <void*>dxData,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1941
 * 
 * 
 * cpdef dropoutBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t dropoutDesc,
 *         size_t dyDesc, size_t dyData,
 */

  /* 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.cuda.cudnn.dropoutBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_187dropoutBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_186dropoutBackward[] = "dropoutBackward(intptr_t handle, size_t dropoutDesc, size_t dyDesc, size_t dyData, size_t dxDesc, size_t dxData, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_187dropoutBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_dropoutDesc;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dyData;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dxData;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dropoutBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_dropoutDesc,&__pyx_n_s_dyDesc,&__pyx_n_s_dyData,&__pyx_n_s_dxDesc,&__pyx_n_s_dxData,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropoutDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 1); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 2); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 3); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 4); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxData)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 5); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 6); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, 7); __PYX_ERR(0, 1941, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dropoutBackward") < 0)) __PYX_ERR(0, 1941, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1942, __pyx_L3_error)
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1942, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1943, __pyx_L3_error)
    __pyx_v_dyData = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dyData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1943, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1944, __pyx_L3_error)
    __pyx_v_dxData = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_dxData == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1944, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1945, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1945, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dropoutBackward", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1941, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.dropoutBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_186dropoutBackward(__pyx_self, __pyx_v_handle, __pyx_v_dropoutDesc, __pyx_v_dyDesc, __pyx_v_dyData, __pyx_v_dxDesc, __pyx_v_dxData, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_186dropoutBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_dropoutDesc, size_t __pyx_v_dyDesc, size_t __pyx_v_dyData, size_t __pyx_v_dxDesc, size_t __pyx_v_dxData, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("dropoutBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_dropoutBackward(__pyx_v_handle, __pyx_v_dropoutDesc, __pyx_v_dyDesc, __pyx_v_dyData, __pyx_v_dxDesc, __pyx_v_dxData, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1941, __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.cuda.cudnn.dropoutBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1959
 * # CTC
 * ###############################################################################
 * cpdef size_t createCTCLossDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef CTCLossDescriptor desc
 *     status = cudnnCreateCTCLossDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_189createCTCLossDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createCTCLossDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnCTCLossDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createCTCLossDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1961
 * cpdef size_t createCTCLossDescriptor() except? 0:
 *     cdef CTCLossDescriptor desc
 *     status = cudnnCreateCTCLossDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateCTCLossDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":1962
 *     cdef CTCLossDescriptor desc
 *     status = cudnnCreateCTCLossDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1963
 *     status = cudnnCreateCTCLossDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * cpdef destroyCTCLossDescriptor(size_t ctcLossDesc):
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1959
 * # CTC
 * ###############################################################################
 * cpdef size_t createCTCLossDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef CTCLossDescriptor desc
 *     status = cudnnCreateCTCLossDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_189createCTCLossDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_188createCTCLossDescriptor[] = "createCTCLossDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_189createCTCLossDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createCTCLossDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_188createCTCLossDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_188createCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createCTCLossDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createCTCLossDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1959, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1965
 *     return <size_t>desc
 * 
 * cpdef destroyCTCLossDescriptor(size_t ctcLossDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyCTCLossDescriptor(<CTCLossDescriptor>ctcLossDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_191destroyCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyCTCLossDescriptor(size_t __pyx_v_ctcLossDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyCTCLossDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1966
 * 
 * cpdef destroyCTCLossDescriptor(size_t ctcLossDesc):
 *     status = cudnnDestroyCTCLossDescriptor(<CTCLossDescriptor>ctcLossDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyCTCLossDescriptor(((cudnnCTCLossDescriptor_t)__pyx_v_ctcLossDesc));

  /* "cupy/cuda/cudnn.pyx":1967
 * cpdef destroyCTCLossDescriptor(size_t ctcLossDesc):
 *     status = cudnnDestroyCTCLossDescriptor(<CTCLossDescriptor>ctcLossDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef setCTCLossDescriptor(size_t ctcLossDesc, int dataType):
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1965
 *     return <size_t>desc
 * 
 * cpdef destroyCTCLossDescriptor(size_t ctcLossDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyCTCLossDescriptor(<CTCLossDescriptor>ctcLossDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_191destroyCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_190destroyCTCLossDescriptor[] = "destroyCTCLossDescriptor(size_t ctcLossDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_191destroyCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc) {
  size_t __pyx_v_ctcLossDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyCTCLossDescriptor (wrapper)", 0);
  assert(__pyx_arg_ctcLossDesc); {
    __pyx_v_ctcLossDesc = __Pyx_PyInt_As_size_t(__pyx_arg_ctcLossDesc); if (unlikely((__pyx_v_ctcLossDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1965, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_190destroyCTCLossDescriptor(__pyx_self, ((size_t)__pyx_v_ctcLossDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_190destroyCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyCTCLossDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyCTCLossDescriptor(__pyx_v_ctcLossDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1965, __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.cuda.cudnn.destroyCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1969
 *     check_status(status)
 * 
 * cpdef setCTCLossDescriptor(size_t ctcLossDesc, int dataType):             # <<<<<<<<<<<<<<
 *     status = cudnnSetCTCLossDescriptor(
 *         <CTCLossDescriptor>ctcLossDesc, <DataType>dataType)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_193setCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setCTCLossDescriptor(size_t __pyx_v_ctcLossDesc, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setCTCLossDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1970
 * 
 * cpdef setCTCLossDescriptor(size_t ctcLossDesc, int dataType):
 *     status = cudnnSetCTCLossDescriptor(             # <<<<<<<<<<<<<<
 *         <CTCLossDescriptor>ctcLossDesc, <DataType>dataType)
 *     check_status(status)
 */
  __pyx_v_status = cudnnSetCTCLossDescriptor(((cudnnCTCLossDescriptor_t)__pyx_v_ctcLossDesc), ((cudnnDataType_t)__pyx_v_dataType));

  /* "cupy/cuda/cudnn.pyx":1972
 *     status = cudnnSetCTCLossDescriptor(
 *         <CTCLossDescriptor>ctcLossDesc, <DataType>dataType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef getCTCLossDescriptor(size_t ctcLossDesc):
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1969
 *     check_status(status)
 * 
 * cpdef setCTCLossDescriptor(size_t ctcLossDesc, int dataType):             # <<<<<<<<<<<<<<
 *     status = cudnnSetCTCLossDescriptor(
 *         <CTCLossDescriptor>ctcLossDesc, <DataType>dataType)
 */

  /* 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.cuda.cudnn.setCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_193setCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_192setCTCLossDescriptor[] = "setCTCLossDescriptor(size_t ctcLossDesc, int dataType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_193setCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_ctcLossDesc;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setCTCLossDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctcLossDesc,&__pyx_n_s_dataType,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctcLossDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setCTCLossDescriptor", 1, 2, 2, 1); __PYX_ERR(0, 1969, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setCTCLossDescriptor") < 0)) __PYX_ERR(0, 1969, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_ctcLossDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_ctcLossDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1969, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1969, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setCTCLossDescriptor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1969, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_192setCTCLossDescriptor(__pyx_self, __pyx_v_ctcLossDesc, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_192setCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setCTCLossDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setCTCLossDescriptor(__pyx_v_ctcLossDesc, __pyx_v_dataType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1969, __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.cuda.cudnn.setCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1974
 *     check_status(status)
 * 
 * cpdef getCTCLossDescriptor(size_t ctcLossDesc):             # <<<<<<<<<<<<<<
 *     cdef DataType compType
 *     status = cudnnGetCTCLossDescriptor(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_195getCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getCTCLossDescriptor(size_t __pyx_v_ctcLossDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnDataType_t __pyx_v_compType;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getCTCLossDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":1976
 * cpdef getCTCLossDescriptor(size_t ctcLossDesc):
 *     cdef DataType compType
 *     status = cudnnGetCTCLossDescriptor(             # <<<<<<<<<<<<<<
 *         <CTCLossDescriptor>ctcLossDesc, &compType)
 *     check_status(status)
 */
  __pyx_v_status = cudnnGetCTCLossDescriptor(((cudnnCTCLossDescriptor_t)__pyx_v_ctcLossDesc), (&__pyx_v_compType));

  /* "cupy/cuda/cudnn.pyx":1978
 *     status = cudnnGetCTCLossDescriptor(
 *         <CTCLossDescriptor>ctcLossDesc, &compType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return compType
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1979
 *         <CTCLossDescriptor>ctcLossDesc, &compType)
 *     check_status(status)
 *     return compType             # <<<<<<<<<<<<<<
 * 
 * cpdef size_t getCTCLossWorkspaceSize(
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnDataType_t(__pyx_v_compType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1974
 *     check_status(status)
 * 
 * cpdef getCTCLossDescriptor(size_t ctcLossDesc):             # <<<<<<<<<<<<<<
 *     cdef DataType compType
 *     status = cudnnGetCTCLossDescriptor(
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_195getCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_194getCTCLossDescriptor[] = "getCTCLossDescriptor(size_t ctcLossDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_195getCTCLossDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_ctcLossDesc) {
  size_t __pyx_v_ctcLossDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCTCLossDescriptor (wrapper)", 0);
  assert(__pyx_arg_ctcLossDesc); {
    __pyx_v_ctcLossDesc = __Pyx_PyInt_As_size_t(__pyx_arg_ctcLossDesc); if (unlikely((__pyx_v_ctcLossDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1974, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_194getCTCLossDescriptor(__pyx_self, ((size_t)__pyx_v_ctcLossDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_194getCTCLossDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_ctcLossDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getCTCLossDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getCTCLossDescriptor(__pyx_v_ctcLossDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1974, __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.cuda.cudnn.getCTCLossDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":1981
 *     return compType
 * 
 * cpdef size_t getCTCLossWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t probsDesc, size_t gradientsDesc,
 *         size_t labels, size_t labelLengths, size_t inputLengths,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_197getCTCLossWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_getCTCLossWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_gradientsDesc, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getCTCLossWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":1986
 *         int algo, size_t ctcLossDesc) except? 0:
 *     cdef size_t sizeInBytes
 *     status = cudnnGetCTCLossWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>probsDesc,
 *         <TensorDescriptor>gradientsDesc,
 */
  __pyx_v_status = cudnnGetCTCLossWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_probsDesc), ((cudnnTensorDescriptor_t)__pyx_v_gradientsDesc), ((int *)__pyx_v_labels), ((int *)__pyx_v_labelLengths), ((int *)__pyx_v_inputLengths), ((cudnnCTCLossAlgo_t)__pyx_v_algo), ((cudnnCTCLossDescriptor_t)__pyx_v_ctcLossDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":1991
 *         <int*>labels, <int*>labelLengths, <int*>inputLengths,
 *         <CTCLossAlgo>algo, <CTCLossDescriptor>ctcLossDesc, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1992
 *         <CTCLossAlgo>algo, <CTCLossDescriptor>ctcLossDesc, &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * cpdef CTCLoss(
 */
  __pyx_r = __pyx_v_sizeInBytes;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":1981
 *     return compType
 * 
 * cpdef size_t getCTCLossWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t probsDesc, size_t gradientsDesc,
 *         size_t labels, size_t labelLengths, size_t inputLengths,
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_197getCTCLossWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_196getCTCLossWorkspaceSize[] = "getCTCLossWorkspaceSize(intptr_t handle, size_t probsDesc, size_t gradientsDesc, size_t labels, size_t labelLengths, size_t inputLengths, int algo, size_t ctcLossDesc) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_197getCTCLossWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_probsDesc;
  size_t __pyx_v_gradientsDesc;
  size_t __pyx_v_labels;
  size_t __pyx_v_labelLengths;
  size_t __pyx_v_inputLengths;
  int __pyx_v_algo;
  size_t __pyx_v_ctcLossDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getCTCLossWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_probsDesc,&__pyx_n_s_gradientsDesc,&__pyx_n_s_labels,&__pyx_n_s_labelLengths,&__pyx_n_s_inputLengths,&__pyx_n_s_algo,&__pyx_n_s_ctcLossDesc,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_probsDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 1); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradientsDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 2); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 3); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_labelLengths)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 4); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inputLengths)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 5); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 6); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctcLossDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, 7); __PYX_ERR(0, 1981, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCTCLossWorkspaceSize") < 0)) __PYX_ERR(0, 1981, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1982, __pyx_L3_error)
    __pyx_v_probsDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_probsDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1982, __pyx_L3_error)
    __pyx_v_gradientsDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_gradientsDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1982, __pyx_L3_error)
    __pyx_v_labels = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_labels == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1983, __pyx_L3_error)
    __pyx_v_labelLengths = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_labelLengths == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1983, __pyx_L3_error)
    __pyx_v_inputLengths = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_inputLengths == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1983, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1984, __pyx_L3_error)
    __pyx_v_ctcLossDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_ctcLossDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1984, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getCTCLossWorkspaceSize", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1981, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getCTCLossWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_196getCTCLossWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_probsDesc, __pyx_v_gradientsDesc, __pyx_v_labels, __pyx_v_labelLengths, __pyx_v_inputLengths, __pyx_v_algo, __pyx_v_ctcLossDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_196getCTCLossWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_gradientsDesc, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getCTCLossWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getCTCLossWorkspaceSize(__pyx_v_handle, __pyx_v_probsDesc, __pyx_v_gradientsDesc, __pyx_v_labels, __pyx_v_labelLengths, __pyx_v_inputLengths, __pyx_v_algo, __pyx_v_ctcLossDesc, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 1981, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":1994
 *     return sizeInBytes
 * 
 * cpdef CTCLoss(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t probsDesc,
 *         size_t probs, size_t labels, size_t labelLengths, size_t inputLengths,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_199CTCLoss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_CTCLoss(intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_probs, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, size_t __pyx_v_costs, size_t __pyx_v_gradientsDesc, size_t __pyx_v_gradients, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("CTCLoss", 0);

  /* "cupy/cuda/cudnn.pyx":2000
 *         int algo, size_t ctcLossDesc,
 *         size_t workspace, size_t workSpaceSizeInBytes):
 *     status = cudnnCTCLoss(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <TensorDescriptor>probsDesc, <void*>probs,
 *         <int*>labels, <int*>labelLengths, <int*>inputLengths,
 */
  __pyx_v_status = cudnnCTCLoss(((cudnnHandle_t)__pyx_v_handle), ((cudnnTensorDescriptor_t)__pyx_v_probsDesc), ((void *)__pyx_v_probs), ((int *)__pyx_v_labels), ((int *)__pyx_v_labelLengths), ((int *)__pyx_v_inputLengths), ((void *)__pyx_v_costs), ((cudnnTensorDescriptor_t)__pyx_v_gradientsDesc), ((void *)__pyx_v_gradients), ((cudnnCTCLossAlgo_t)__pyx_v_algo), ((cudnnCTCLossDescriptor_t)__pyx_v_ctcLossDesc), ((void *)__pyx_v_workspace), ((size_t)__pyx_v_workSpaceSizeInBytes));

  /* "cupy/cuda/cudnn.pyx":2006
 *         <CTCLossAlgo>algo, <CTCLossDescriptor>ctcLossDesc,
 *         <void*>workspace, <size_t>workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1994
 *     return sizeInBytes
 * 
 * cpdef CTCLoss(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t probsDesc,
 *         size_t probs, size_t labels, size_t labelLengths, size_t inputLengths,
 */

  /* 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.cuda.cudnn.CTCLoss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_199CTCLoss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_198CTCLoss[] = "CTCLoss(intptr_t handle, size_t probsDesc, size_t probs, size_t labels, size_t labelLengths, size_t inputLengths, size_t costs, size_t gradientsDesc, size_t gradients, int algo, size_t ctcLossDesc, size_t workspace, size_t workSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_199CTCLoss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_probsDesc;
  size_t __pyx_v_probs;
  size_t __pyx_v_labels;
  size_t __pyx_v_labelLengths;
  size_t __pyx_v_inputLengths;
  size_t __pyx_v_costs;
  size_t __pyx_v_gradientsDesc;
  size_t __pyx_v_gradients;
  int __pyx_v_algo;
  size_t __pyx_v_ctcLossDesc;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("CTCLoss (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_probsDesc,&__pyx_n_s_probs,&__pyx_n_s_labels,&__pyx_n_s_labelLengths,&__pyx_n_s_inputLengths,&__pyx_n_s_costs,&__pyx_n_s_gradientsDesc,&__pyx_n_s_gradients,&__pyx_n_s_algo,&__pyx_n_s_ctcLossDesc,&__pyx_n_s_workspace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_probsDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 1); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_probs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 2); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 3); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_labelLengths)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 4); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inputLengths)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 5); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_costs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 6); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradientsDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 7); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gradients)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 8); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 9); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctcLossDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 10); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 11); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, 12); __PYX_ERR(0, 1994, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "CTCLoss") < 0)) __PYX_ERR(0, 1994, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1995, __pyx_L3_error)
    __pyx_v_probsDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_probsDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1995, __pyx_L3_error)
    __pyx_v_probs = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_probs == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1996, __pyx_L3_error)
    __pyx_v_labels = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_labels == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1996, __pyx_L3_error)
    __pyx_v_labelLengths = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_labelLengths == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1996, __pyx_L3_error)
    __pyx_v_inputLengths = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_inputLengths == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1996, __pyx_L3_error)
    __pyx_v_costs = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_costs == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1997, __pyx_L3_error)
    __pyx_v_gradientsDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_gradientsDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1997, __pyx_L3_error)
    __pyx_v_gradients = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_gradients == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1997, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1998, __pyx_L3_error)
    __pyx_v_ctcLossDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_ctcLossDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1998, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1999, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1999, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("CTCLoss", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1994, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.CTCLoss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_198CTCLoss(__pyx_self, __pyx_v_handle, __pyx_v_probsDesc, __pyx_v_probs, __pyx_v_labels, __pyx_v_labelLengths, __pyx_v_inputLengths, __pyx_v_costs, __pyx_v_gradientsDesc, __pyx_v_gradients, __pyx_v_algo, __pyx_v_ctcLossDesc, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_198CTCLoss(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_probsDesc, size_t __pyx_v_probs, size_t __pyx_v_labels, size_t __pyx_v_labelLengths, size_t __pyx_v_inputLengths, size_t __pyx_v_costs, size_t __pyx_v_gradientsDesc, size_t __pyx_v_gradients, int __pyx_v_algo, size_t __pyx_v_ctcLossDesc, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("CTCLoss", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_CTCLoss(__pyx_v_handle, __pyx_v_probsDesc, __pyx_v_probs, __pyx_v_labels, __pyx_v_labelLengths, __pyx_v_inputLengths, __pyx_v_costs, __pyx_v_gradientsDesc, __pyx_v_gradients, __pyx_v_algo, __pyx_v_ctcLossDesc, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1994, __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.cuda.cudnn.CTCLoss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2013
 * ###############################################################################
 * 
 * cpdef size_t createRNNDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef RNNDescriptor desc
 *     status = cudnnCreateRNNDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_201createRNNDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createRNNDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnRNNDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createRNNDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2015
 * cpdef size_t createRNNDescriptor() except? 0:
 *     cdef RNNDescriptor desc
 *     status = cudnnCreateRNNDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateRNNDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":2016
 *     cdef RNNDescriptor desc
 *     status = cudnnCreateRNNDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2017
 *     status = cudnnCreateRNNDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2013
 * ###############################################################################
 * 
 * cpdef size_t createRNNDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef RNNDescriptor desc
 *     status = cudnnCreateRNNDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_201createRNNDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_200createRNNDescriptor[] = "createRNNDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_201createRNNDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createRNNDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_200createRNNDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_200createRNNDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createRNNDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createRNNDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 2013, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":2020
 * 
 * 
 * cpdef destroyRNNDescriptor(size_t rnnDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyRNNDescriptor(<RNNDescriptor>rnnDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_203destroyRNNDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDescriptor(size_t __pyx_v_rnnDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyRNNDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2021
 * 
 * cpdef destroyRNNDescriptor(size_t rnnDesc):
 *     status = cudnnDestroyRNNDescriptor(<RNNDescriptor>rnnDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyRNNDescriptor(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc));

  /* "cupy/cuda/cudnn.pyx":2022
 * cpdef destroyRNNDescriptor(size_t rnnDesc):
 *     status = cudnnDestroyRNNDescriptor(<RNNDescriptor>rnnDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2020
 * 
 * 
 * cpdef destroyRNNDescriptor(size_t rnnDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyRNNDescriptor(<RNNDescriptor>rnnDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyRNNDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_203destroyRNNDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_202destroyRNNDescriptor[] = "destroyRNNDescriptor(size_t rnnDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_203destroyRNNDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc) {
  size_t __pyx_v_rnnDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyRNNDescriptor (wrapper)", 0);
  assert(__pyx_arg_rnnDesc); {
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(__pyx_arg_rnnDesc); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2020, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyRNNDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_202destroyRNNDescriptor(__pyx_self, ((size_t)__pyx_v_rnnDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_202destroyRNNDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyRNNDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyRNNDescriptor(__pyx_v_rnnDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2020, __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.cuda.cudnn.destroyRNNDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2025
 * 
 * 
 * cpdef size_t createPersistentRNNPlan(size_t rnnDesc, int minibatch,             # <<<<<<<<<<<<<<
 *                                      int dataType) except? 0:
 *     cdef PersistentRNNPlan plan
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_205createPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createPersistentRNNPlan(size_t __pyx_v_rnnDesc, int __pyx_v_minibatch, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnPersistentRNNPlan_t __pyx_v_plan;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createPersistentRNNPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2028
 *                                      int dataType) except? 0:
 *     cdef PersistentRNNPlan plan
 *     status = cudnnCreatePersistentRNNPlan(             # <<<<<<<<<<<<<<
 *         <RNNDescriptor>rnnDesc,
 *         <int>minibatch, <DataType>dataType, &plan)
 */
  __pyx_v_status = cudnnCreatePersistentRNNPlan(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((int)__pyx_v_minibatch), ((cudnnDataType_t)__pyx_v_dataType), (&__pyx_v_plan));

  /* "cupy/cuda/cudnn.pyx":2031
 *         <RNNDescriptor>rnnDesc,
 *         <int>minibatch, <DataType>dataType, &plan)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>plan
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2032
 *         <int>minibatch, <DataType>dataType, &plan)
 *     check_status(status)
 *     return <size_t>plan             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_plan);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2025
 * 
 * 
 * cpdef size_t createPersistentRNNPlan(size_t rnnDesc, int minibatch,             # <<<<<<<<<<<<<<
 *                                      int dataType) except? 0:
 *     cdef PersistentRNNPlan plan
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_205createPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_204createPersistentRNNPlan[] = "createPersistentRNNPlan(size_t rnnDesc, int minibatch, int dataType) -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_205createPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_rnnDesc;
  int __pyx_v_minibatch;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createPersistentRNNPlan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnnDesc,&__pyx_n_s_minibatch,&__pyx_n_s_dataType,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minibatch)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createPersistentRNNPlan", 1, 3, 3, 1); __PYX_ERR(0, 2025, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("createPersistentRNNPlan", 1, 3, 3, 2); __PYX_ERR(0, 2025, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "createPersistentRNNPlan") < 0)) __PYX_ERR(0, 2025, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2025, __pyx_L3_error)
    __pyx_v_minibatch = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_minibatch == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2025, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2026, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("createPersistentRNNPlan", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.createPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_204createPersistentRNNPlan(__pyx_self, __pyx_v_rnnDesc, __pyx_v_minibatch, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_204createPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_minibatch, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createPersistentRNNPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createPersistentRNNPlan(__pyx_v_rnnDesc, __pyx_v_minibatch, __pyx_v_dataType, 0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 2025, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":2035
 * 
 * 
 * cpdef setPersistentRNNPlan(size_t rnnDesc, size_t plan):             # <<<<<<<<<<<<<<
 *     status = cudnnSetPersistentRNNPlan(
 *         <RNNDescriptor>rnnDesc, <PersistentRNNPlan>plan)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_207setPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setPersistentRNNPlan(size_t __pyx_v_rnnDesc, size_t __pyx_v_plan, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPersistentRNNPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2036
 * 
 * cpdef setPersistentRNNPlan(size_t rnnDesc, size_t plan):
 *     status = cudnnSetPersistentRNNPlan(             # <<<<<<<<<<<<<<
 *         <RNNDescriptor>rnnDesc, <PersistentRNNPlan>plan)
 *     check_status(status)
 */
  __pyx_v_status = cudnnSetPersistentRNNPlan(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnPersistentRNNPlan_t)__pyx_v_plan));

  /* "cupy/cuda/cudnn.pyx":2038
 *     status = cudnnSetPersistentRNNPlan(
 *         <RNNDescriptor>rnnDesc, <PersistentRNNPlan>plan)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2035
 * 
 * 
 * cpdef setPersistentRNNPlan(size_t rnnDesc, size_t plan):             # <<<<<<<<<<<<<<
 *     status = cudnnSetPersistentRNNPlan(
 *         <RNNDescriptor>rnnDesc, <PersistentRNNPlan>plan)
 */

  /* 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.cuda.cudnn.setPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_207setPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_206setPersistentRNNPlan[] = "setPersistentRNNPlan(size_t rnnDesc, size_t plan)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_207setPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_plan;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setPersistentRNNPlan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnnDesc,&__pyx_n_s_plan,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_plan)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setPersistentRNNPlan", 1, 2, 2, 1); __PYX_ERR(0, 2035, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setPersistentRNNPlan") < 0)) __PYX_ERR(0, 2035, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2035, __pyx_L3_error)
    __pyx_v_plan = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_plan == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2035, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setPersistentRNNPlan", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2035, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_206setPersistentRNNPlan(__pyx_self, __pyx_v_rnnDesc, __pyx_v_plan);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_206setPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, size_t __pyx_v_plan) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setPersistentRNNPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setPersistentRNNPlan(__pyx_v_rnnDesc, __pyx_v_plan, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __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.cuda.cudnn.setPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2041
 * 
 * 
 * cpdef destroyPersistentRNNPlan(size_t plan):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyPersistentRNNPlan(<PersistentRNNPlan>plan)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_209destroyPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyPersistentRNNPlan(size_t __pyx_v_plan, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyPersistentRNNPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2042
 * 
 * cpdef destroyPersistentRNNPlan(size_t plan):
 *     status = cudnnDestroyPersistentRNNPlan(<PersistentRNNPlan>plan)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyPersistentRNNPlan(((cudnnPersistentRNNPlan_t)__pyx_v_plan));

  /* "cupy/cuda/cudnn.pyx":2043
 * cpdef destroyPersistentRNNPlan(size_t plan):
 *     status = cudnnDestroyPersistentRNNPlan(<PersistentRNNPlan>plan)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2041
 * 
 * 
 * cpdef destroyPersistentRNNPlan(size_t plan):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyPersistentRNNPlan(<PersistentRNNPlan>plan)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_209destroyPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_208destroyPersistentRNNPlan[] = "destroyPersistentRNNPlan(size_t plan)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_209destroyPersistentRNNPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan) {
  size_t __pyx_v_plan;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyPersistentRNNPlan (wrapper)", 0);
  assert(__pyx_arg_plan); {
    __pyx_v_plan = __Pyx_PyInt_As_size_t(__pyx_arg_plan); if (unlikely((__pyx_v_plan == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2041, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_208destroyPersistentRNNPlan(__pyx_self, ((size_t)__pyx_v_plan));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_208destroyPersistentRNNPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_plan) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyPersistentRNNPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyPersistentRNNPlan(__pyx_v_plan, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2041, __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.cuda.cudnn.destroyPersistentRNNPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2046
 * 
 * 
 * cpdef setRNNDescriptor_v5(             # <<<<<<<<<<<<<<
 *         size_t rnnDesc, int hiddenSize, int numLayers,
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_211setRNNDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v5(size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDescriptor_v5", 0);

  /* "cupy/cuda/cudnn.pyx":2050
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 *         int dataType):
 *     status = cudnnSetRNNDescriptor_v5(             # <<<<<<<<<<<<<<
 *         <RNNDescriptor>rnnDesc, hiddenSize, numLayers,
 *         <DropoutDescriptor>dropoutDesc, <RNNInputMode>inputMode,
 */
  __pyx_v_status = cudnnSetRNNDescriptor_v5(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_hiddenSize, __pyx_v_numLayers, ((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc), ((cudnnRNNInputMode_t)__pyx_v_inputMode), ((cudnnDirectionMode_t)__pyx_v_direction), ((cudnnRNNMode_t)__pyx_v_mode), ((cudnnDataType_t)__pyx_v_dataType));

  /* "cupy/cuda/cudnn.pyx":2054
 *         <DropoutDescriptor>dropoutDesc, <RNNInputMode>inputMode,
 *         <DirectionMode>direction, <RNNMode>mode, <DataType>dataType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2046
 * 
 * 
 * cpdef setRNNDescriptor_v5(             # <<<<<<<<<<<<<<
 *         size_t rnnDesc, int hiddenSize, int numLayers,
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 */

  /* 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.cuda.cudnn.setRNNDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_211setRNNDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_210setRNNDescriptor_v5[] = "setRNNDescriptor_v5(size_t rnnDesc, int hiddenSize, int numLayers, size_t dropoutDesc, int inputMode, int direction, int mode, int dataType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_211setRNNDescriptor_v5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_rnnDesc;
  int __pyx_v_hiddenSize;
  int __pyx_v_numLayers;
  size_t __pyx_v_dropoutDesc;
  int __pyx_v_inputMode;
  int __pyx_v_direction;
  int __pyx_v_mode;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRNNDescriptor_v5 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnnDesc,&__pyx_n_s_hiddenSize,&__pyx_n_s_numLayers,&__pyx_n_s_dropoutDesc,&__pyx_n_s_inputMode,&__pyx_n_s_direction,&__pyx_n_s_mode,&__pyx_n_s_dataType,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hiddenSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 1); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numLayers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 2); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropoutDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 3); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inputMode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 4); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_direction)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 5); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 6); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, 7); __PYX_ERR(0, 2046, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRNNDescriptor_v5") < 0)) __PYX_ERR(0, 2046, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2047, __pyx_L3_error)
    __pyx_v_hiddenSize = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_hiddenSize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2047, __pyx_L3_error)
    __pyx_v_numLayers = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_numLayers == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2047, __pyx_L3_error)
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2048, __pyx_L3_error)
    __pyx_v_inputMode = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_inputMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2048, __pyx_L3_error)
    __pyx_v_direction = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2048, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2048, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2049, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v5", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2046, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setRNNDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_210setRNNDescriptor_v5(__pyx_self, __pyx_v_rnnDesc, __pyx_v_hiddenSize, __pyx_v_numLayers, __pyx_v_dropoutDesc, __pyx_v_inputMode, __pyx_v_direction, __pyx_v_mode, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_210setRNNDescriptor_v5(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDescriptor_v5", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v5(__pyx_v_rnnDesc, __pyx_v_hiddenSize, __pyx_v_numLayers, __pyx_v_dropoutDesc, __pyx_v_inputMode, __pyx_v_direction, __pyx_v_mode, __pyx_v_dataType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2046, __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.cuda.cudnn.setRNNDescriptor_v5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2057
 * 
 * 
 * cpdef setRNNDescriptor_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int hiddenSize, int numLayers,
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_213setRNNDescriptor_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v6(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_algo, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDescriptor_v6", 0);

  /* "cupy/cuda/cudnn.pyx":2061
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 *         int algo, int dataType):
 *     status = cudnnSetRNNDescriptor_v6(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, hiddenSize, numLayers,
 *         <DropoutDescriptor>dropoutDesc, <RNNInputMode>inputMode,
 */
  __pyx_v_status = cudnnSetRNNDescriptor_v6(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_hiddenSize, __pyx_v_numLayers, ((cudnnDropoutDescriptor_t)__pyx_v_dropoutDesc), ((cudnnRNNInputMode_t)__pyx_v_inputMode), ((cudnnDirectionMode_t)__pyx_v_direction), ((cudnnRNNMode_t)__pyx_v_mode), ((cudnnRNNAlgo_t)__pyx_v_algo), ((cudnnDataType_t)__pyx_v_dataType));

  /* "cupy/cuda/cudnn.pyx":2066
 *         <DirectionMode>direction, <RNNMode>mode, <RNNAlgo>algo,
 *         <DataType>dataType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2057
 * 
 * 
 * cpdef setRNNDescriptor_v6(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int hiddenSize, int numLayers,
 *         size_t dropoutDesc, int inputMode, int direction, int mode,
 */

  /* 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.cuda.cudnn.setRNNDescriptor_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_213setRNNDescriptor_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_212setRNNDescriptor_v6[] = "setRNNDescriptor_v6(intptr_t handle, size_t rnnDesc, int hiddenSize, int numLayers, size_t dropoutDesc, int inputMode, int direction, int mode, int algo, int dataType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_213setRNNDescriptor_v6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_hiddenSize;
  int __pyx_v_numLayers;
  size_t __pyx_v_dropoutDesc;
  int __pyx_v_inputMode;
  int __pyx_v_direction;
  int __pyx_v_mode;
  int __pyx_v_algo;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRNNDescriptor_v6 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_hiddenSize,&__pyx_n_s_numLayers,&__pyx_n_s_dropoutDesc,&__pyx_n_s_inputMode,&__pyx_n_s_direction,&__pyx_n_s_mode,&__pyx_n_s_algo,&__pyx_n_s_dataType,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 1); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hiddenSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 2); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numLayers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 3); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dropoutDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 4); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inputMode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 5); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_direction)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 6); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 7); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 8); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, 9); __PYX_ERR(0, 2057, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRNNDescriptor_v6") < 0)) __PYX_ERR(0, 2057, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_hiddenSize = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_hiddenSize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_numLayers = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_numLayers == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_dropoutDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dropoutDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2059, __pyx_L3_error)
    __pyx_v_inputMode = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_inputMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2059, __pyx_L3_error)
    __pyx_v_direction = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2059, __pyx_L3_error)
    __pyx_v_mode = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_mode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2059, __pyx_L3_error)
    __pyx_v_algo = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_algo == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2060, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2060, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRNNDescriptor_v6", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2057, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setRNNDescriptor_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_212setRNNDescriptor_v6(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_hiddenSize, __pyx_v_numLayers, __pyx_v_dropoutDesc, __pyx_v_inputMode, __pyx_v_direction, __pyx_v_mode, __pyx_v_algo, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_212setRNNDescriptor_v6(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_hiddenSize, int __pyx_v_numLayers, size_t __pyx_v_dropoutDesc, int __pyx_v_inputMode, int __pyx_v_direction, int __pyx_v_mode, int __pyx_v_algo, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDescriptor_v6", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v6(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_hiddenSize, __pyx_v_numLayers, __pyx_v_dropoutDesc, __pyx_v_inputMode, __pyx_v_direction, __pyx_v_mode, __pyx_v_algo, __pyx_v_dataType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2057, __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.cuda.cudnn.setRNNDescriptor_v6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2069
 * 
 * 
 * cpdef setRNNPaddingMode(             # <<<<<<<<<<<<<<
 *         size_t rnnDesc, int paddingMode):
 *     status = cudnnSetRNNPaddingMode(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_215setRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNPaddingMode(size_t __pyx_v_rnnDesc, int __pyx_v_paddingMode, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNPaddingMode", 0);

  /* "cupy/cuda/cudnn.pyx":2071
 * cpdef setRNNPaddingMode(
 *         size_t rnnDesc, int paddingMode):
 *     status = cudnnSetRNNPaddingMode(             # <<<<<<<<<<<<<<
 *         <RNNDescriptor>rnnDesc, <RNNPaddingMode>paddingMode)
 *     check_status(status)
 */
  __pyx_v_status = cudnnSetRNNPaddingMode(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnRNNPaddingMode_t)__pyx_v_paddingMode));

  /* "cupy/cuda/cudnn.pyx":2073
 *     status = cudnnSetRNNPaddingMode(
 *         <RNNDescriptor>rnnDesc, <RNNPaddingMode>paddingMode)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2069
 * 
 * 
 * cpdef setRNNPaddingMode(             # <<<<<<<<<<<<<<
 *         size_t rnnDesc, int paddingMode):
 *     status = cudnnSetRNNPaddingMode(
 */

  /* 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.cuda.cudnn.setRNNPaddingMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_215setRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_214setRNNPaddingMode[] = "setRNNPaddingMode(size_t rnnDesc, int paddingMode)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_215setRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_rnnDesc;
  int __pyx_v_paddingMode;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRNNPaddingMode (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnnDesc,&__pyx_n_s_paddingMode,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paddingMode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNPaddingMode", 1, 2, 2, 1); __PYX_ERR(0, 2069, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRNNPaddingMode") < 0)) __PYX_ERR(0, 2069, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2070, __pyx_L3_error)
    __pyx_v_paddingMode = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_paddingMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2070, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRNNPaddingMode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2069, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setRNNPaddingMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_214setRNNPaddingMode(__pyx_self, __pyx_v_rnnDesc, __pyx_v_paddingMode);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_214setRNNPaddingMode(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc, int __pyx_v_paddingMode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNPaddingMode", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setRNNPaddingMode(__pyx_v_rnnDesc, __pyx_v_paddingMode, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2069, __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.cuda.cudnn.setRNNPaddingMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2076
 * 
 * 
 * cpdef getRNNPaddingMode(size_t rnnDesc):             # <<<<<<<<<<<<<<
 *     cdef RNNPaddingMode paddingMode
 *     status = cudnnGetRNNPaddingMode(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_217getRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNPaddingMode(size_t __pyx_v_rnnDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnRNNPaddingMode_t __pyx_v_paddingMode;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNPaddingMode", 0);

  /* "cupy/cuda/cudnn.pyx":2078
 * cpdef getRNNPaddingMode(size_t rnnDesc):
 *     cdef RNNPaddingMode paddingMode
 *     status = cudnnGetRNNPaddingMode(             # <<<<<<<<<<<<<<
 *         <RNNDescriptor>rnnDesc, &paddingMode)
 *     check_status(status)
 */
  __pyx_v_status = cudnnGetRNNPaddingMode(((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), (&__pyx_v_paddingMode));

  /* "cupy/cuda/cudnn.pyx":2080
 *     status = cudnnGetRNNPaddingMode(
 *         <RNNDescriptor>rnnDesc, &paddingMode)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return paddingMode
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2081
 *         <RNNDescriptor>rnnDesc, &paddingMode)
 *     check_status(status)
 *     return paddingMode             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_cudnnRNNPaddingMode_t(__pyx_v_paddingMode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2076
 * 
 * 
 * cpdef getRNNPaddingMode(size_t rnnDesc):             # <<<<<<<<<<<<<<
 *     cdef RNNPaddingMode paddingMode
 *     status = cudnnGetRNNPaddingMode(
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_217getRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_216getRNNPaddingMode[] = "getRNNPaddingMode(size_t rnnDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_217getRNNPaddingMode(PyObject *__pyx_self, PyObject *__pyx_arg_rnnDesc) {
  size_t __pyx_v_rnnDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNPaddingMode (wrapper)", 0);
  assert(__pyx_arg_rnnDesc); {
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(__pyx_arg_rnnDesc); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2076, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNPaddingMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_216getRNNPaddingMode(__pyx_self, ((size_t)__pyx_v_rnnDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_216getRNNPaddingMode(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_rnnDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNPaddingMode", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNPaddingMode(__pyx_v_rnnDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __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.cuda.cudnn.getRNNPaddingMode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2084
 * 
 * 
 * cpdef size_t createRNNDataDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef RNNDataDescriptor desc
 *     status = cudnnCreateRNNDataDescriptor(&desc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_219createRNNDataDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createRNNDataDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnRNNDataDescriptor_t __pyx_v_desc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createRNNDataDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2086
 * cpdef size_t createRNNDataDescriptor() except? 0:
 *     cdef RNNDataDescriptor desc
 *     status = cudnnCreateRNNDataDescriptor(&desc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>desc
 */
  __pyx_v_status = cudnnCreateRNNDataDescriptor((&__pyx_v_desc));

  /* "cupy/cuda/cudnn.pyx":2087
 *     cdef RNNDataDescriptor desc
 *     status = cudnnCreateRNNDataDescriptor(&desc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>desc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2088
 *     status = cudnnCreateRNNDataDescriptor(&desc)
 *     check_status(status)
 *     return <size_t>desc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_desc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2084
 * 
 * 
 * cpdef size_t createRNNDataDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef RNNDataDescriptor desc
 *     status = cudnnCreateRNNDataDescriptor(&desc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_219createRNNDataDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_218createRNNDataDescriptor[] = "createRNNDataDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_219createRNNDataDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createRNNDataDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_218createRNNDataDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_218createRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createRNNDataDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createRNNDataDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 2084, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":2091
 * 
 * 
 * cpdef destroyRNNDataDescriptor(size_t RNNDataDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyRNNDataDescriptor(<RNNDataDescriptor>RNNDataDesc)
 *     check_status(status)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_221destroyRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_RNNDataDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDataDescriptor(size_t __pyx_v_RNNDataDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyRNNDataDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2092
 * 
 * cpdef destroyRNNDataDescriptor(size_t RNNDataDesc):
 *     status = cudnnDestroyRNNDataDescriptor(<RNNDataDescriptor>RNNDataDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
  __pyx_v_status = cudnnDestroyRNNDataDescriptor(((cudnnRNNDataDescriptor_t)__pyx_v_RNNDataDesc));

  /* "cupy/cuda/cudnn.pyx":2093
 * cpdef destroyRNNDataDescriptor(size_t RNNDataDesc):
 *     status = cudnnDestroyRNNDataDescriptor(<RNNDataDescriptor>RNNDataDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2091
 * 
 * 
 * cpdef destroyRNNDataDescriptor(size_t RNNDataDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroyRNNDataDescriptor(<RNNDataDescriptor>RNNDataDesc)
 *     check_status(status)
 */

  /* 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.cuda.cudnn.destroyRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_221destroyRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_RNNDataDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_220destroyRNNDataDescriptor[] = "destroyRNNDataDescriptor(size_t RNNDataDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_221destroyRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_RNNDataDesc) {
  size_t __pyx_v_RNNDataDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyRNNDataDescriptor (wrapper)", 0);
  assert(__pyx_arg_RNNDataDesc); {
    __pyx_v_RNNDataDesc = __Pyx_PyInt_As_size_t(__pyx_arg_RNNDataDesc); if (unlikely((__pyx_v_RNNDataDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2091, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_220destroyRNNDataDescriptor(__pyx_self, ((size_t)__pyx_v_RNNDataDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_220destroyRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyRNNDataDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyRNNDataDescriptor(__pyx_v_RNNDataDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2091, __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.cuda.cudnn.destroyRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2096
 * 
 * 
 * cpdef setRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         size_t RNNDataDesc, int dataType, size_t layout,
 *         int maxSeqLength, int batchSize, int vectorSize,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_223setRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setRNNDataDescriptor(size_t __pyx_v_RNNDataDesc, int __pyx_v_dataType, size_t __pyx_v_layout, int __pyx_v_maxSeqLength, int __pyx_v_batchSize, int __pyx_v_vectorSize, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDataDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2100
 *         int maxSeqLength, int batchSize, int vectorSize,
 *         size_t seqLengthArray, size_t paddingFill):
 *     status = cudnnSetRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         <RNNDataDescriptor>RNNDataDesc, <DataType>dataType,
 *         <RNNDataLayout>layout, maxSeqLength, batchSize, vectorSize,
 */
  __pyx_v_status = cudnnSetRNNDataDescriptor(((cudnnRNNDataDescriptor_t)__pyx_v_RNNDataDesc), ((cudnnDataType_t)__pyx_v_dataType), ((cudnnRNNDataLayout_t)__pyx_v_layout), __pyx_v_maxSeqLength, __pyx_v_batchSize, __pyx_v_vectorSize, ((int const *)__pyx_v_seqLengthArray), ((void *)__pyx_v_paddingFill));

  /* "cupy/cuda/cudnn.pyx":2104
 *         <RNNDataLayout>layout, maxSeqLength, batchSize, vectorSize,
 *         <const int*>seqLengthArray, <void*>paddingFill)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2096
 * 
 * 
 * cpdef setRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         size_t RNNDataDesc, int dataType, size_t layout,
 *         int maxSeqLength, int batchSize, int vectorSize,
 */

  /* 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.cuda.cudnn.setRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_223setRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_222setRNNDataDescriptor[] = "setRNNDataDescriptor(size_t RNNDataDesc, int dataType, size_t layout, int maxSeqLength, int batchSize, int vectorSize, size_t seqLengthArray, size_t paddingFill)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_223setRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_RNNDataDesc;
  int __pyx_v_dataType;
  size_t __pyx_v_layout;
  int __pyx_v_maxSeqLength;
  int __pyx_v_batchSize;
  int __pyx_v_vectorSize;
  size_t __pyx_v_seqLengthArray;
  size_t __pyx_v_paddingFill;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRNNDataDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_RNNDataDesc,&__pyx_n_s_dataType,&__pyx_n_s_layout,&__pyx_n_s_maxSeqLength,&__pyx_n_s_batchSize,&__pyx_n_s_vectorSize,&__pyx_n_s_seqLengthArray,&__pyx_n_s_paddingFill,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_RNNDataDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 1); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 2); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxSeqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 3); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_batchSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 4); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectorSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 5); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLengthArray)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 6); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paddingFill)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, 7); __PYX_ERR(0, 2096, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRNNDataDescriptor") < 0)) __PYX_ERR(0, 2096, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_RNNDataDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_RNNDataDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2097, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2097, __pyx_L3_error)
    __pyx_v_layout = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_layout == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2097, __pyx_L3_error)
    __pyx_v_maxSeqLength = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxSeqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2098, __pyx_L3_error)
    __pyx_v_batchSize = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_batchSize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2098, __pyx_L3_error)
    __pyx_v_vectorSize = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_vectorSize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2098, __pyx_L3_error)
    __pyx_v_seqLengthArray = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_seqLengthArray == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2099, __pyx_L3_error)
    __pyx_v_paddingFill = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_paddingFill == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2099, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRNNDataDescriptor", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2096, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_222setRNNDataDescriptor(__pyx_self, __pyx_v_RNNDataDesc, __pyx_v_dataType, __pyx_v_layout, __pyx_v_maxSeqLength, __pyx_v_batchSize, __pyx_v_vectorSize, __pyx_v_seqLengthArray, __pyx_v_paddingFill);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_222setRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc, int __pyx_v_dataType, size_t __pyx_v_layout, int __pyx_v_maxSeqLength, int __pyx_v_batchSize, int __pyx_v_vectorSize, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setRNNDataDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setRNNDataDescriptor(__pyx_v_RNNDataDesc, __pyx_v_dataType, __pyx_v_layout, __pyx_v_maxSeqLength, __pyx_v_batchSize, __pyx_v_vectorSize, __pyx_v_seqLengthArray, __pyx_v_paddingFill, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2096, __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.cuda.cudnn.setRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2107
 * 
 * 
 * cpdef getRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         size_t RNNDataDesc, size_t dataType,
 *         size_t layout, size_t maxSeqLength, size_t batchSize,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_225getRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNDataDescriptor(size_t __pyx_v_RNNDataDesc, size_t __pyx_v_dataType, size_t __pyx_v_layout, size_t __pyx_v_maxSeqLength, size_t __pyx_v_batchSize, size_t __pyx_v_vectorSize, int __pyx_v_arrayLengthRequested, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNDataDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2112
 *         size_t vectorSize, int arrayLengthRequested, size_t seqLengthArray,
 *         size_t paddingFill):
 *     status = cudnnGetRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         <RNNDataDescriptor>RNNDataDesc, <DataType*>dataType,
 *         <RNNDataLayout*>layout, <int*>maxSeqLength, <int*>batchSize,
 */
  __pyx_v_status = cudnnGetRNNDataDescriptor(((cudnnRNNDataDescriptor_t)__pyx_v_RNNDataDesc), ((cudnnDataType_t *)__pyx_v_dataType), ((cudnnRNNDataLayout_t *)__pyx_v_layout), ((int *)__pyx_v_maxSeqLength), ((int *)__pyx_v_batchSize), ((int *)__pyx_v_vectorSize), __pyx_v_arrayLengthRequested, ((int *)__pyx_v_seqLengthArray), ((void *)__pyx_v_paddingFill));

  /* "cupy/cuda/cudnn.pyx":2117
 *         <int*>vectorSize, arrayLengthRequested, <int*>seqLengthArray,
 *         <void*>paddingFill)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2107
 * 
 * 
 * cpdef getRNNDataDescriptor(             # <<<<<<<<<<<<<<
 *         size_t RNNDataDesc, size_t dataType,
 *         size_t layout, size_t maxSeqLength, size_t batchSize,
 */

  /* 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.cuda.cudnn.getRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_225getRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_224getRNNDataDescriptor[] = "getRNNDataDescriptor(size_t RNNDataDesc, size_t dataType, size_t layout, size_t maxSeqLength, size_t batchSize, size_t vectorSize, int arrayLengthRequested, size_t seqLengthArray, size_t paddingFill)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_225getRNNDataDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_RNNDataDesc;
  size_t __pyx_v_dataType;
  size_t __pyx_v_layout;
  size_t __pyx_v_maxSeqLength;
  size_t __pyx_v_batchSize;
  size_t __pyx_v_vectorSize;
  int __pyx_v_arrayLengthRequested;
  size_t __pyx_v_seqLengthArray;
  size_t __pyx_v_paddingFill;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNDataDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_RNNDataDesc,&__pyx_n_s_dataType,&__pyx_n_s_layout,&__pyx_n_s_maxSeqLength,&__pyx_n_s_batchSize,&__pyx_n_s_vectorSize,&__pyx_n_s_arrayLengthRequested,&__pyx_n_s_seqLengthArray,&__pyx_n_s_paddingFill,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_RNNDataDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 1); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 2); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxSeqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 3); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_batchSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 4); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectorSize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 5); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arrayLengthRequested)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 6); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLengthArray)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 7); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paddingFill)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, 8); __PYX_ERR(0, 2107, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNDataDescriptor") < 0)) __PYX_ERR(0, 2107, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_RNNDataDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_RNNDataDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2108, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_dataType == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2108, __pyx_L3_error)
    __pyx_v_layout = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_layout == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2109, __pyx_L3_error)
    __pyx_v_maxSeqLength = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_maxSeqLength == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2109, __pyx_L3_error)
    __pyx_v_batchSize = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_batchSize == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2109, __pyx_L3_error)
    __pyx_v_vectorSize = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_vectorSize == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2110, __pyx_L3_error)
    __pyx_v_arrayLengthRequested = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_arrayLengthRequested == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2110, __pyx_L3_error)
    __pyx_v_seqLengthArray = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_seqLengthArray == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2110, __pyx_L3_error)
    __pyx_v_paddingFill = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_paddingFill == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2111, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNDataDescriptor", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_224getRNNDataDescriptor(__pyx_self, __pyx_v_RNNDataDesc, __pyx_v_dataType, __pyx_v_layout, __pyx_v_maxSeqLength, __pyx_v_batchSize, __pyx_v_vectorSize, __pyx_v_arrayLengthRequested, __pyx_v_seqLengthArray, __pyx_v_paddingFill);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_224getRNNDataDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_RNNDataDesc, size_t __pyx_v_dataType, size_t __pyx_v_layout, size_t __pyx_v_maxSeqLength, size_t __pyx_v_batchSize, size_t __pyx_v_vectorSize, int __pyx_v_arrayLengthRequested, size_t __pyx_v_seqLengthArray, size_t __pyx_v_paddingFill) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNDataDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNDataDescriptor(__pyx_v_RNNDataDesc, __pyx_v_dataType, __pyx_v_layout, __pyx_v_maxSeqLength, __pyx_v_batchSize, __pyx_v_vectorSize, __pyx_v_arrayLengthRequested, __pyx_v_seqLengthArray, __pyx_v_paddingFill, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2107, __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.cuda.cudnn.getRNNDataDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2120
 * 
 * 
 * cpdef getRNNWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_227getRNNWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNWorkspaceSize(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNWorkspaceSize", 0);

  /* "cupy/cuda/cudnn.pyx":2123
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 *     status = cudnnGetRNNWorkspaceSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 */
  __pyx_v_status = cudnnGetRNNWorkspaceSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_xDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":2126
 *         <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2127
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_sizeInBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2120
 * 
 * 
 * cpdef getRNNWorkspaceSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_227getRNNWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_226getRNNWorkspaceSize[] = "getRNNWorkspaceSize(intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_227getRNNWorkspaceSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_xDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNWorkspaceSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_xDesc,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNWorkspaceSize", 1, 4, 4, 1); __PYX_ERR(0, 2120, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNWorkspaceSize", 1, 4, 4, 2); __PYX_ERR(0, 2120, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNWorkspaceSize", 1, 4, 4, 3); __PYX_ERR(0, 2120, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNWorkspaceSize") < 0)) __PYX_ERR(0, 2120, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2121, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2121, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2121, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2121, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNWorkspaceSize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_226getRNNWorkspaceSize(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_226getRNNWorkspaceSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNWorkspaceSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNWorkspaceSize(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __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.cuda.cudnn.getRNNWorkspaceSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2130
 * 
 * 
 * cpdef getRNNTrainingReserveSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_229getRNNTrainingReserveSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNTrainingReserveSize(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNTrainingReserveSize", 0);

  /* "cupy/cuda/cudnn.pyx":2133
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 *     status = cudnnGetRNNTrainingReserveSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 */
  __pyx_v_status = cudnnGetRNNTrainingReserveSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_xDesc), (&__pyx_v_sizeInBytes));

  /* "cupy/cuda/cudnn.pyx":2136
 *         <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2137
 *         <TensorDescriptor*>xDesc, &sizeInBytes)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_sizeInBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2130
 * 
 * 
 * cpdef getRNNTrainingReserveSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc):
 *     cdef size_t sizeInBytes
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_229getRNNTrainingReserveSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_228getRNNTrainingReserveSize[] = "getRNNTrainingReserveSize(intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_229getRNNTrainingReserveSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_xDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNTrainingReserveSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_xDesc,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNTrainingReserveSize", 1, 4, 4, 1); __PYX_ERR(0, 2130, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNTrainingReserveSize", 1, 4, 4, 2); __PYX_ERR(0, 2130, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNTrainingReserveSize", 1, 4, 4, 3); __PYX_ERR(0, 2130, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNTrainingReserveSize") < 0)) __PYX_ERR(0, 2130, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNTrainingReserveSize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2130, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNTrainingReserveSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_228getRNNTrainingReserveSize(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_228getRNNTrainingReserveSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNTrainingReserveSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNTrainingReserveSize(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2130, __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.cuda.cudnn.getRNNTrainingReserveSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2140
 * 
 * 
 * cpdef getRNNParamsSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, int dataType):
 *     cdef size_t sizeInBytes
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_231getRNNParamsSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNParamsSize(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, int __pyx_v_dataType, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_sizeInBytes;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNParamsSize", 0);

  /* "cupy/cuda/cudnn.pyx":2143
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, int dataType):
 *     cdef size_t sizeInBytes
 *     status = cudnnGetRNNParamsSize(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, <TensorDescriptor>xDesc,
 *         &sizeInBytes, <DataType>dataType)
 */
  __pyx_v_status = cudnnGetRNNParamsSize(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), (&__pyx_v_sizeInBytes), ((cudnnDataType_t)__pyx_v_dataType));

  /* "cupy/cuda/cudnn.pyx":2146
 *         <Handle>handle, <RNNDescriptor>rnnDesc, <TensorDescriptor>xDesc,
 *         &sizeInBytes, <DataType>dataType)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return sizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2147
 *         &sizeInBytes, <DataType>dataType)
 *     check_status(status)
 *     return sizeInBytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_sizeInBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2140
 * 
 * 
 * cpdef getRNNParamsSize(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, int dataType):
 *     cdef size_t sizeInBytes
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_231getRNNParamsSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_230getRNNParamsSize[] = "getRNNParamsSize(intptr_t handle, size_t rnnDesc, size_t xDesc, int dataType)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_231getRNNParamsSize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_xDesc;
  int __pyx_v_dataType;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNParamsSize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_xDesc,&__pyx_n_s_dataType,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNParamsSize", 1, 4, 4, 1); __PYX_ERR(0, 2140, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNParamsSize", 1, 4, 4, 2); __PYX_ERR(0, 2140, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNParamsSize", 1, 4, 4, 3); __PYX_ERR(0, 2140, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNParamsSize") < 0)) __PYX_ERR(0, 2140, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2141, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2141, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2141, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2141, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNParamsSize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2140, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNParamsSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_230getRNNParamsSize(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_dataType);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_230getRNNParamsSize(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, int __pyx_v_dataType) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNParamsSize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNParamsSize(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_dataType, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2140, __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.cuda.cudnn.getRNNParamsSize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2150
 * 
 * 
 * cpdef getRNNLinLayerMatrixParams(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc,
 *         size_t w, int linLayerID, size_t linLayerMatDesc, size_t linLayerMat):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_233getRNNLinLayerMatrixParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerMatrixParams(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerMatDesc, size_t __pyx_v_linLayerMat, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNLinLayerMatrixParams", 0);

  /* "cupy/cuda/cudnn.pyx":2153
 *         intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc,
 *         size_t w, int linLayerID, size_t linLayerMatDesc, size_t linLayerMat):
 *     status = cudnnGetRNNLinLayerMatrixParams(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, layer,
 *         <TensorDescriptor>xDesc, <FilterDescriptor>wDesc, <void*>w,
 */
  __pyx_v_status = cudnnGetRNNLinLayerMatrixParams(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_layer, ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), __pyx_v_linLayerID, ((cudnnFilterDescriptor_t)__pyx_v_linLayerMatDesc), ((void **)__pyx_v_linLayerMat));

  /* "cupy/cuda/cudnn.pyx":2157
 *         <TensorDescriptor>xDesc, <FilterDescriptor>wDesc, <void*>w,
 *         linLayerID, <FilterDescriptor>linLayerMatDesc, <void**>linLayerMat)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2150
 * 
 * 
 * cpdef getRNNLinLayerMatrixParams(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc,
 *         size_t w, int linLayerID, size_t linLayerMatDesc, size_t linLayerMat):
 */

  /* 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.cuda.cudnn.getRNNLinLayerMatrixParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_233getRNNLinLayerMatrixParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_232getRNNLinLayerMatrixParams[] = "getRNNLinLayerMatrixParams(intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc, size_t w, int linLayerID, size_t linLayerMatDesc, size_t linLayerMat)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_233getRNNLinLayerMatrixParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_layer;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  int __pyx_v_linLayerID;
  size_t __pyx_v_linLayerMatDesc;
  size_t __pyx_v_linLayerMat;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNLinLayerMatrixParams (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_layer,&__pyx_n_s_xDesc,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_linLayerID,&__pyx_n_s_linLayerMatDesc,&__pyx_n_s_linLayerMat,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 1); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 2); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 3); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 4); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 5); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerID)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 6); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerMatDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 7); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerMat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, 8); __PYX_ERR(0, 2150, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNLinLayerMatrixParams") < 0)) __PYX_ERR(0, 2150, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L3_error)
    __pyx_v_layer = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_layer == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2151, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L3_error)
    __pyx_v_linLayerID = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_linLayerID == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L3_error)
    __pyx_v_linLayerMatDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_linLayerMatDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L3_error)
    __pyx_v_linLayerMat = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_linLayerMat == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNLinLayerMatrixParams", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNLinLayerMatrixParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_232getRNNLinLayerMatrixParams(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_layer, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_w, __pyx_v_linLayerID, __pyx_v_linLayerMatDesc, __pyx_v_linLayerMat);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_232getRNNLinLayerMatrixParams(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerMatDesc, size_t __pyx_v_linLayerMat) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNLinLayerMatrixParams", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerMatrixParams(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_layer, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_w, __pyx_v_linLayerID, __pyx_v_linLayerMatDesc, __pyx_v_linLayerMat, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __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.cuda.cudnn.getRNNLinLayerMatrixParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2160
 * 
 * 
 * cpdef getRNNLinLayerBiasParams(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc,
 *         size_t w, int linLayerID, size_t linLayerBiasDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_235getRNNLinLayerBiasParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerBiasParams(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerBiasDesc, size_t __pyx_v_linLayerBias, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNLinLayerBiasParams", 0);

  /* "cupy/cuda/cudnn.pyx":2164
 *         size_t w, int linLayerID, size_t linLayerBiasDesc,
 *         size_t linLayerBias):
 *     status = cudnnGetRNNLinLayerBiasParams(             # <<<<<<<<<<<<<<
 *         <Handle>handle, <RNNDescriptor>rnnDesc, layer,
 *         <TensorDescriptor>xDesc, <FilterDescriptor>wDesc, <void*>w,
 */
  __pyx_v_status = cudnnGetRNNLinLayerBiasParams(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_layer, ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), __pyx_v_linLayerID, ((cudnnFilterDescriptor_t)__pyx_v_linLayerBiasDesc), ((void **)__pyx_v_linLayerBias));

  /* "cupy/cuda/cudnn.pyx":2168
 *         <TensorDescriptor>xDesc, <FilterDescriptor>wDesc, <void*>w,
 *         linLayerID, <FilterDescriptor>linLayerBiasDesc, <void**>linLayerBias)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2160
 * 
 * 
 * cpdef getRNNLinLayerBiasParams(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc,
 *         size_t w, int linLayerID, size_t linLayerBiasDesc,
 */

  /* 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.cuda.cudnn.getRNNLinLayerBiasParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_235getRNNLinLayerBiasParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_234getRNNLinLayerBiasParams[] = "getRNNLinLayerBiasParams(intptr_t handle, size_t rnnDesc, int layer, size_t xDesc, size_t wDesc, size_t w, int linLayerID, size_t linLayerBiasDesc, size_t linLayerBias)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_235getRNNLinLayerBiasParams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_layer;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  int __pyx_v_linLayerID;
  size_t __pyx_v_linLayerBiasDesc;
  size_t __pyx_v_linLayerBias;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRNNLinLayerBiasParams (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_layer,&__pyx_n_s_xDesc,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_linLayerID,&__pyx_n_s_linLayerBiasDesc,&__pyx_n_s_linLayerBias,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 1); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 2); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 3); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 4); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 5); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerID)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 6); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerBiasDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 7); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_linLayerBias)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, 8); __PYX_ERR(0, 2160, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getRNNLinLayerBiasParams") < 0)) __PYX_ERR(0, 2160, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L3_error)
    __pyx_v_layer = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_layer == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2162, __pyx_L3_error)
    __pyx_v_linLayerID = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_linLayerID == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2162, __pyx_L3_error)
    __pyx_v_linLayerBiasDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_linLayerBiasDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2162, __pyx_L3_error)
    __pyx_v_linLayerBias = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_linLayerBias == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2163, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getRNNLinLayerBiasParams", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2160, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getRNNLinLayerBiasParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_234getRNNLinLayerBiasParams(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_layer, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_w, __pyx_v_linLayerID, __pyx_v_linLayerBiasDesc, __pyx_v_linLayerBias);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_234getRNNLinLayerBiasParams(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_layer, size_t __pyx_v_xDesc, size_t __pyx_v_wDesc, size_t __pyx_v_w, int __pyx_v_linLayerID, size_t __pyx_v_linLayerBiasDesc, size_t __pyx_v_linLayerBias) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getRNNLinLayerBiasParams", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerBiasParams(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_layer, __pyx_v_xDesc, __pyx_v_wDesc, __pyx_v_w, __pyx_v_linLayerID, __pyx_v_linLayerBiasDesc, __pyx_v_linLayerBias, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2160, __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.cuda.cudnn.getRNNLinLayerBiasParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2171
 * 
 * 
 * cpdef RNNForwardInference(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc,
 *         size_t x, size_t hxDesc, size_t hx, size_t cxDesc,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_237RNNForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInference(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardInference", 0);

  /* "cupy/cuda/cudnn.pyx":2177
 *         size_t y, size_t hyDesc, size_t hy, size_t cyDesc,
 *         size_t cy, size_t workspace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNForwardInference(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2178
 *         size_t cy, size_t workspace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardInference(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2179
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNForwardInference(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *             <TensorDescriptor*>xDesc, <void*>x,
 */
        __pyx_v_status = cudnnRNNForwardInference(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void *)__pyx_v_cx), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnTensorDescriptor_t *)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_hyDesc), ((void *)__pyx_v_hy), ((cudnnTensorDescriptor_t)__pyx_v_cyDesc), ((void *)__pyx_v_cy), ((void *)__pyx_v_workspace), __pyx_v_workSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2178
 *         size_t cy, size_t workspace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardInference(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2189
 *             <TensorDescriptor>cyDesc, <void*>cy,
 *             <void*>workspace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2171
 * 
 * 
 * cpdef RNNForwardInference(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc,
 *         size_t x, size_t hxDesc, size_t hx, size_t cxDesc,
 */

  /* 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.cuda.cudnn.RNNForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_237RNNForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_236RNNForwardInference[] = "RNNForwardInference(intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w, size_t yDesc, size_t y, size_t hyDesc, size_t hy, size_t cyDesc, size_t cy, size_t workspace, size_t workSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_237RNNForwardInference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_hyDesc;
  size_t __pyx_v_hy;
  size_t __pyx_v_cyDesc;
  size_t __pyx_v_cy;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNForwardInference (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_hyDesc,&__pyx_n_s_hy,&__pyx_n_s_cyDesc,&__pyx_n_s_cy,&__pyx_n_s_workspace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 1); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 2); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 3); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 4); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 5); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 6); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 7); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 8); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 9); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 10); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 11); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 12); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 13); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 14); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 15); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 16); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 17); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, 18); __PYX_ERR(0, 2171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNForwardInference") < 0)) __PYX_ERR(0, 2171, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 19) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2173, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2173, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2173, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2173, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2174, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2174, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2174, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2174, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2175, __pyx_L3_error)
    __pyx_v_hyDesc = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_hyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2175, __pyx_L3_error)
    __pyx_v_hy = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_hy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2175, __pyx_L3_error)
    __pyx_v_cyDesc = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_cyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2175, __pyx_L3_error)
    __pyx_v_cy = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_cy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNForwardInference", 1, 19, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_236RNNForwardInference(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_236RNNForwardInference(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardInference", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNForwardInference(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __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.cuda.cudnn.RNNForwardInference", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2192
 * 
 * 
 * cpdef RNNForwardTraining(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t cxDesc, size_t cx,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_239RNNForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTraining(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardTraining", 0);

  /* "cupy/cuda/cudnn.pyx":2199
 *         size_t workspace, size_t workSpaceSizeInBytes, size_t reserveSpace,
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNForwardTraining(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2200
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardTraining(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2201
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNForwardTraining(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *             <TensorDescriptor*>xDesc, <void*>x,
 */
        __pyx_v_status = cudnnRNNForwardTraining(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void *)__pyx_v_cx), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnTensorDescriptor_t *)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_hyDesc), ((void *)__pyx_v_hy), ((cudnnTensorDescriptor_t)__pyx_v_cyDesc), ((void *)__pyx_v_cy), ((void *)__pyx_v_workspace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2200
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardTraining(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2212
 *             <void*>workspace, workSpaceSizeInBytes,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2192
 * 
 * 
 * cpdef RNNForwardTraining(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t cxDesc, size_t cx,
 */

  /* 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.cuda.cudnn.RNNForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_239RNNForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_238RNNForwardTraining[] = "RNNForwardTraining(intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w, size_t yDesc, size_t y, size_t hyDesc, size_t hy, size_t cyDesc, size_t cy, size_t workspace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_239RNNForwardTraining(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_hyDesc;
  size_t __pyx_v_hy;
  size_t __pyx_v_cyDesc;
  size_t __pyx_v_cy;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNForwardTraining (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_hyDesc,&__pyx_n_s_hy,&__pyx_n_s_cyDesc,&__pyx_n_s_cy,&__pyx_n_s_workspace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 1); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 2); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 3); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 4); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 5); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 6); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 7); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 8); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 9); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 10); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 11); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 12); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 13); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 14); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 15); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 16); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 17); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 18); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 19); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, 20); __PYX_ERR(0, 2192, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNForwardTraining") < 0)) __PYX_ERR(0, 2192, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2194, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2194, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2194, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2194, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2195, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2195, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2195, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2195, __pyx_L3_error)
    __pyx_v_hyDesc = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_hyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2196, __pyx_L3_error)
    __pyx_v_hy = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_hy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2196, __pyx_L3_error)
    __pyx_v_cyDesc = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_cyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2196, __pyx_L3_error)
    __pyx_v_cy = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_cy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2196, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2197, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2197, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2197, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2198, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNForwardTraining", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2192, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_238RNNForwardTraining(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_238RNNForwardTraining(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardTraining", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNForwardTraining(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2192, __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.cuda.cudnn.RNNForwardTraining", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2215
 * 
 * 
 * cpdef RNNBackwardData(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t yDesc, size_t y,
 *         size_t dyDesc, size_t dy, size_t dhyDesc, size_t dhy,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_241RNNBackwardData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardData(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardData", 0);

  /* "cupy/cuda/cudnn.pyx":2224
 *         size_t workSpaceSizeInBytes, size_t reserveSpace,
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNBackwardData(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2225
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardData(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2226
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNBackwardData(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *             <TensorDescriptor*>yDesc, <void*>y,
 */
        __pyx_v_status = cudnnRNNBackwardData(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t *)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((cudnnTensorDescriptor_t)__pyx_v_dhyDesc), ((void *)__pyx_v_dhy), ((cudnnTensorDescriptor_t)__pyx_v_dcyDesc), ((void *)__pyx_v_dcy), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void *)__pyx_v_w), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void *)__pyx_v_cx), ((cudnnTensorDescriptor_t *)__pyx_v_dxDesc), ((void *)__pyx_v_dx), ((cudnnTensorDescriptor_t)__pyx_v_dhxDesc), ((void *)__pyx_v_dhx), ((cudnnTensorDescriptor_t)__pyx_v_dcxDesc), ((void *)__pyx_v_dcx), ((void *)__pyx_v_workspace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2225
 *         size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardData(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2240
 *             <void*>workspace, workSpaceSizeInBytes,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2215
 * 
 * 
 * cpdef RNNBackwardData(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t yDesc, size_t y,
 *         size_t dyDesc, size_t dy, size_t dhyDesc, size_t dhy,
 */

  /* 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.cuda.cudnn.RNNBackwardData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_241RNNBackwardData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_240RNNBackwardData[] = "RNNBackwardData(intptr_t handle, size_t rnnDesc, int seqLength, size_t yDesc, size_t y, size_t dyDesc, size_t dy, size_t dhyDesc, size_t dhy, size_t dcyDesc, size_t dcy, size_t wDesc, size_t w, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t dxDesc, size_t dx, size_t dhxDesc, size_t dhx, size_t dcxDesc, size_t dcx, size_t workspace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_241RNNBackwardData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_dhyDesc;
  size_t __pyx_v_dhy;
  size_t __pyx_v_dcyDesc;
  size_t __pyx_v_dcy;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  size_t __pyx_v_dhxDesc;
  size_t __pyx_v_dhx;
  size_t __pyx_v_dcxDesc;
  size_t __pyx_v_dcx;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNBackwardData (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_dhyDesc,&__pyx_n_s_dhy,&__pyx_n_s_dcyDesc,&__pyx_n_s_dcy,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_dhxDesc,&__pyx_n_s_dhx,&__pyx_n_s_dcxDesc,&__pyx_n_s_dcx,&__pyx_n_s_workspace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[27] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
        CYTHON_FALLTHROUGH;
        case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
        CYTHON_FALLTHROUGH;
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 1); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 2); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 3); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 4); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 5); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 6); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 7); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 8); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 9); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 10); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 11); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 12); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 13); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 14); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 15); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 16); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 17); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 18); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 19); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 20); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 21); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 22); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 23); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 24); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 25:
        if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 25); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 26:
        if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, 26); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNBackwardData") < 0)) __PYX_ERR(0, 2215, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 27) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
      values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
      values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2216, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2216, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2216, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2216, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2216, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2217, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2217, __pyx_L3_error)
    __pyx_v_dhyDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dhyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2217, __pyx_L3_error)
    __pyx_v_dhy = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_dhy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2217, __pyx_L3_error)
    __pyx_v_dcyDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_dcyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2218, __pyx_L3_error)
    __pyx_v_dcy = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_dcy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2218, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2218, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2218, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2219, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2219, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2219, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2219, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L3_error)
    __pyx_v_dhxDesc = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_dhxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L3_error)
    __pyx_v_dhx = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_dhx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L3_error)
    __pyx_v_dcxDesc = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_dcxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2221, __pyx_L3_error)
    __pyx_v_dcx = __Pyx_PyInt_As_size_t(values[22]); if (unlikely((__pyx_v_dcx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2221, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2221, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2222, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[25]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2222, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[26]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2223, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNBackwardData", 1, 27, 27, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNBackwardData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_240RNNBackwardData(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dhyDesc, __pyx_v_dhy, __pyx_v_dcyDesc, __pyx_v_dcy, __pyx_v_wDesc, __pyx_v_w, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dhxDesc, __pyx_v_dhx, __pyx_v_dcxDesc, __pyx_v_dcx, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_240RNNBackwardData(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardData", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNBackwardData(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dhyDesc, __pyx_v_dhy, __pyx_v_dcyDesc, __pyx_v_dcy, __pyx_v_wDesc, __pyx_v_w, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dhxDesc, __pyx_v_dhx, __pyx_v_dcxDesc, __pyx_v_dcx, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2215, __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.cuda.cudnn.RNNBackwardData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2243
 * 
 * 
 * cpdef RNNBackwardWeights(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t yDesc, size_t y,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_243RNNBackwardWeights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeights(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardWeights", 0);

  /* "cupy/cuda/cudnn.pyx":2248
 *         size_t workspace, size_t workSpaceSizeInBytes, size_t dwDesc,
 *         size_t dw, size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNBackwardWeights(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2249
 *         size_t dw, size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardWeights(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2250
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNBackwardWeights(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 *             <TensorDescriptor*>xDesc, <void*>x,
 */
        __pyx_v_status = cudnnRNNBackwardWeights(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), __pyx_v_seqLength, ((cudnnTensorDescriptor_t *)__pyx_v_xDesc), ((void *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void *)__pyx_v_hx), ((cudnnTensorDescriptor_t *)__pyx_v_yDesc), ((void *)__pyx_v_y), ((void *)__pyx_v_workspace), __pyx_v_workSpaceSizeInBytes, ((cudnnFilterDescriptor_t)__pyx_v_dwDesc), ((void *)__pyx_v_dw), ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2249
 *         size_t dw, size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardWeights(
 *             <Handle>handle, <RNNDescriptor>rnnDesc, seqLength,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2258
 *             <FilterDescriptor>dwDesc, <void*>dw,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2243
 * 
 * 
 * cpdef RNNBackwardWeights(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t yDesc, size_t y,
 */

  /* 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.cuda.cudnn.RNNBackwardWeights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_243RNNBackwardWeights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_242RNNBackwardWeights[] = "RNNBackwardWeights(intptr_t handle, size_t rnnDesc, int seqLength, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t yDesc, size_t y, size_t workspace, size_t workSpaceSizeInBytes, size_t dwDesc, size_t dw, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_243RNNBackwardWeights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  int __pyx_v_seqLength;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_workspace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_dwDesc;
  size_t __pyx_v_dw;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNBackwardWeights (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_seqLength,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_workspace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_dwDesc,&__pyx_n_s_dw,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 1); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seqLength)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 2); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 3); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 4); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 5); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 6); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 7); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 8); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workspace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 9); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 10); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dwDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 11); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 12); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 13); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, 14); __PYX_ERR(0, 2243, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNBackwardWeights") < 0)) __PYX_ERR(0, 2243, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 15) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2244, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2244, __pyx_L3_error)
    __pyx_v_seqLength = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_seqLength == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2244, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2244, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2244, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2245, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2245, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2245, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2245, __pyx_L3_error)
    __pyx_v_workspace = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workspace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2246, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2246, __pyx_L3_error)
    __pyx_v_dwDesc = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_dwDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2246, __pyx_L3_error)
    __pyx_v_dw = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_dw == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2247, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2247, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2247, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNBackwardWeights", 1, 15, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2243, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNBackwardWeights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_242RNNBackwardWeights(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_yDesc, __pyx_v_y, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_242RNNBackwardWeights(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, int __pyx_v_seqLength, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workspace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardWeights", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeights(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_seqLength, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_yDesc, __pyx_v_y, __pyx_v_workspace, __pyx_v_workSpaceSizeInBytes, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2243, __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.cuda.cudnn.RNNBackwardWeights", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2261
 * 
 * 
 * cpdef RNNForwardInferenceEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc,
 *         size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_245RNNForwardInferenceEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInferenceEx(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardInferenceEx", 0);

  /* "cupy/cuda/cudnn.pyx":2268
 *         size_t iDesc, size_t iAttn, size_t qDesc, size_t queries,
 *         size_t workSpace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNForwardInferenceEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2269
 *         size_t workSpace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardInferenceEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2270
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNForwardInferenceEx(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 *             <RNNDataDescriptor>xDesc, <const void*>x,
 */
        __pyx_v_status = cudnnRNNForwardInferenceEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnRNNDataDescriptor_t)__pyx_v_xDesc), ((void const *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void const *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void const *)__pyx_v_cx), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void const *)__pyx_v_w), ((cudnnRNNDataDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_hyDesc), ((void *)__pyx_v_hy), ((cudnnTensorDescriptor_t)__pyx_v_cyDesc), ((void *)__pyx_v_cy), ((cudnnRNNDataDescriptor_t)__pyx_v_kDesc), ((void const *)__pyx_v_keys), ((cudnnRNNDataDescriptor_t)__pyx_v_cDesc), ((void *)__pyx_v_cAttn), ((cudnnRNNDataDescriptor_t)__pyx_v_iDesc), ((void *)__pyx_v_iAttn), ((cudnnRNNDataDescriptor_t)__pyx_v_qDesc), ((void *)__pyx_v_queries), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2269
 *         size_t workSpace, size_t workSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardInferenceEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2284
 *             <RNNDataDescriptor>qDesc, <void*>queries,
 *             <void*>workSpace, workSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2261
 * 
 * 
 * cpdef RNNForwardInferenceEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc,
 *         size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w,
 */

  /* 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.cuda.cudnn.RNNForwardInferenceEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_245RNNForwardInferenceEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_244RNNForwardInferenceEx[] = "RNNForwardInferenceEx(intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w, size_t yDesc, size_t y, size_t hyDesc, size_t hy, size_t cyDesc, size_t cy, size_t kDesc, size_t keys, size_t cDesc, size_t cAttn, size_t iDesc, size_t iAttn, size_t qDesc, size_t queries, size_t workSpace, size_t workSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_245RNNForwardInferenceEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_hyDesc;
  size_t __pyx_v_hy;
  size_t __pyx_v_cyDesc;
  size_t __pyx_v_cy;
  size_t __pyx_v_kDesc;
  size_t __pyx_v_keys;
  size_t __pyx_v_cDesc;
  size_t __pyx_v_cAttn;
  size_t __pyx_v_iDesc;
  size_t __pyx_v_iAttn;
  size_t __pyx_v_qDesc;
  size_t __pyx_v_queries;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNForwardInferenceEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_hyDesc,&__pyx_n_s_hy,&__pyx_n_s_cyDesc,&__pyx_n_s_cy,&__pyx_n_s_kDesc,&__pyx_n_s_keys,&__pyx_n_s_cDesc,&__pyx_n_s_cAttn,&__pyx_n_s_iDesc,&__pyx_n_s_iAttn,&__pyx_n_s_qDesc,&__pyx_n_s_queries,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,0};
    PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
        CYTHON_FALLTHROUGH;
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 1); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 2); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 3); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 4); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 5); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 6); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 7); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 8); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 9); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 10); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 11); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 12); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 13); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 14); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 15); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 16); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keys)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 17); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 18); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cAttn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 19); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 20); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iAttn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 21); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 22); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queries)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 23); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 24); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 25:
        if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, 25); __PYX_ERR(0, 2261, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNForwardInferenceEx") < 0)) __PYX_ERR(0, 2261, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
      values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2262, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2262, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2262, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2262, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2262, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2263, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
    __pyx_v_hyDesc = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_hyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
    __pyx_v_hy = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_hy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
    __pyx_v_cyDesc = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_cyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
    __pyx_v_cy = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_cy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2265, __pyx_L3_error)
    __pyx_v_kDesc = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_kDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2265, __pyx_L3_error)
    __pyx_v_keys = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_keys == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2265, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2265, __pyx_L3_error)
    __pyx_v_cAttn = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_cAttn == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2265, __pyx_L3_error)
    __pyx_v_iDesc = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_iDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2266, __pyx_L3_error)
    __pyx_v_iAttn = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_iAttn == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2266, __pyx_L3_error)
    __pyx_v_qDesc = __Pyx_PyInt_As_size_t(values[22]); if (unlikely((__pyx_v_qDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2266, __pyx_L3_error)
    __pyx_v_queries = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_queries == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2266, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2267, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[25]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2267, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNForwardInferenceEx", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2261, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNForwardInferenceEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_244RNNForwardInferenceEx(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_kDesc, __pyx_v_keys, __pyx_v_cDesc, __pyx_v_cAttn, __pyx_v_iDesc, __pyx_v_iAttn, __pyx_v_qDesc, __pyx_v_queries, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_244RNNForwardInferenceEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardInferenceEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNForwardInferenceEx(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_kDesc, __pyx_v_keys, __pyx_v_cDesc, __pyx_v_cAttn, __pyx_v_iDesc, __pyx_v_iAttn, __pyx_v_qDesc, __pyx_v_queries, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2261, __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.cuda.cudnn.RNNForwardInferenceEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2287
 * 
 * 
 * cpdef RNNForwardTrainingEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc,
 *         size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_247RNNForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTrainingEx(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardTrainingEx", 0);

  /* "cupy/cuda/cudnn.pyx":2295
 *         size_t workSpace, size_t workSpaceSizeInBytes,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNForwardTrainingEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2296
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardTrainingEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2297
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNForwardTrainingEx(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 *             <RNNDataDescriptor>xDesc, <const void*>x,
 */
        __pyx_v_status = cudnnRNNForwardTrainingEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnRNNDataDescriptor_t)__pyx_v_xDesc), ((void const *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void const *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void const *)__pyx_v_cx), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void const *)__pyx_v_w), ((cudnnRNNDataDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y), ((cudnnTensorDescriptor_t)__pyx_v_hyDesc), ((void *)__pyx_v_hy), ((cudnnTensorDescriptor_t)__pyx_v_cyDesc), ((void *)__pyx_v_cy), ((cudnnRNNDataDescriptor_t)__pyx_v_kDesc), ((void const *)__pyx_v_keys), ((cudnnRNNDataDescriptor_t)__pyx_v_cDesc), ((void *)__pyx_v_cAttn), ((cudnnRNNDataDescriptor_t)__pyx_v_iDesc), ((void *)__pyx_v_iAttn), ((cudnnRNNDataDescriptor_t)__pyx_v_qDesc), ((void *)__pyx_v_queries), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2296
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNForwardTrainingEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2312
 *             <void*>workSpace, workSpaceSizeInBytes,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2287
 * 
 * 
 * cpdef RNNForwardTrainingEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc,
 *         size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w,
 */

  /* 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.cuda.cudnn.RNNForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_247RNNForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_246RNNForwardTrainingEx[] = "RNNForwardTrainingEx(intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t wDesc, size_t w, size_t yDesc, size_t y, size_t hyDesc, size_t hy, size_t cyDesc, size_t cy, size_t kDesc, size_t keys, size_t cDesc, size_t cAttn, size_t iDesc, size_t iAttn, size_t qDesc, size_t queries, size_t workSpace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_247RNNForwardTrainingEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_hyDesc;
  size_t __pyx_v_hy;
  size_t __pyx_v_cyDesc;
  size_t __pyx_v_cy;
  size_t __pyx_v_kDesc;
  size_t __pyx_v_keys;
  size_t __pyx_v_cDesc;
  size_t __pyx_v_cAttn;
  size_t __pyx_v_iDesc;
  size_t __pyx_v_iAttn;
  size_t __pyx_v_qDesc;
  size_t __pyx_v_queries;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNForwardTrainingEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_hyDesc,&__pyx_n_s_hy,&__pyx_n_s_cyDesc,&__pyx_n_s_cy,&__pyx_n_s_kDesc,&__pyx_n_s_keys,&__pyx_n_s_cDesc,&__pyx_n_s_cAttn,&__pyx_n_s_iDesc,&__pyx_n_s_iAttn,&__pyx_n_s_qDesc,&__pyx_n_s_queries,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[28] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 28: values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
        CYTHON_FALLTHROUGH;
        case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
        CYTHON_FALLTHROUGH;
        case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
        CYTHON_FALLTHROUGH;
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 1); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 2); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 3); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 4); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 5); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 6); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 7); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 8); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 9); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 10); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 11); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 12); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 13); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 14); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 15); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 16); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_keys)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 17); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 18); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cAttn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 19); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 20); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iAttn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 21); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 22); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queries)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 23); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 24); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 25:
        if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 25); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 26:
        if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 26); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 27:
        if (likely((values[27] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, 27); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNForwardTrainingEx") < 0)) __PYX_ERR(0, 2287, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 28) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
      values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
      values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
      values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2288, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2290, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2290, __pyx_L3_error)
    __pyx_v_hyDesc = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_hyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2290, __pyx_L3_error)
    __pyx_v_hy = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_hy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2290, __pyx_L3_error)
    __pyx_v_cyDesc = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_cyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2290, __pyx_L3_error)
    __pyx_v_cy = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_cy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
    __pyx_v_kDesc = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_kDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
    __pyx_v_keys = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_keys == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
    __pyx_v_cDesc = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_cDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
    __pyx_v_cAttn = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_cAttn == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2291, __pyx_L3_error)
    __pyx_v_iDesc = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_iDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2292, __pyx_L3_error)
    __pyx_v_iAttn = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_iAttn == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2292, __pyx_L3_error)
    __pyx_v_qDesc = __Pyx_PyInt_As_size_t(values[22]); if (unlikely((__pyx_v_qDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2292, __pyx_L3_error)
    __pyx_v_queries = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_queries == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2292, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[25]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[26]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2294, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[27]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2294, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNForwardTrainingEx", 1, 28, 28, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_246RNNForwardTrainingEx(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_kDesc, __pyx_v_keys, __pyx_v_cDesc, __pyx_v_cAttn, __pyx_v_iDesc, __pyx_v_iAttn, __pyx_v_qDesc, __pyx_v_queries, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_246RNNForwardTrainingEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_hyDesc, size_t __pyx_v_hy, size_t __pyx_v_cyDesc, size_t __pyx_v_cy, size_t __pyx_v_kDesc, size_t __pyx_v_keys, size_t __pyx_v_cDesc, size_t __pyx_v_cAttn, size_t __pyx_v_iDesc, size_t __pyx_v_iAttn, size_t __pyx_v_qDesc, size_t __pyx_v_queries, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNForwardTrainingEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNForwardTrainingEx(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_wDesc, __pyx_v_w, __pyx_v_yDesc, __pyx_v_y, __pyx_v_hyDesc, __pyx_v_hy, __pyx_v_cyDesc, __pyx_v_cy, __pyx_v_kDesc, __pyx_v_keys, __pyx_v_cDesc, __pyx_v_cAttn, __pyx_v_iDesc, __pyx_v_iAttn, __pyx_v_qDesc, __pyx_v_queries, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2287, __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.cuda.cudnn.RNNForwardTrainingEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2315
 * 
 * 
 * cpdef RNNBackwardDataEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t yDesc, size_t y, size_t dyDesc,
 *         size_t dy, size_t dcDesc, size_t dcAttn, size_t dhyDesc, size_t dhy,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_249RNNBackwardDataEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardDataEx(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dcDesc, size_t __pyx_v_dcAttn, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_dkDesc, size_t __pyx_v_dkeys, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardDataEx", 0);

  /* "cupy/cuda/cudnn.pyx":2324
 *         size_t workSpace, size_t workSpaceSizeInBytes,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNBackwardDataEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2325
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardDataEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2326
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNBackwardDataEx(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 *             <RNNDataDescriptor>yDesc, <const void*>y,
 */
        __pyx_v_status = cudnnRNNBackwardDataEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnRNNDataDescriptor_t)__pyx_v_yDesc), ((void const *)__pyx_v_y), ((cudnnRNNDataDescriptor_t)__pyx_v_dyDesc), ((void const *)__pyx_v_dy), ((cudnnRNNDataDescriptor_t)__pyx_v_dcDesc), ((void const *)__pyx_v_dcAttn), ((cudnnTensorDescriptor_t)__pyx_v_dhyDesc), ((void const *)__pyx_v_dhy), ((cudnnTensorDescriptor_t)__pyx_v_dcyDesc), ((void const *)__pyx_v_dcy), ((cudnnFilterDescriptor_t)__pyx_v_wDesc), ((void const *)__pyx_v_w), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void const *)__pyx_v_hx), ((cudnnTensorDescriptor_t)__pyx_v_cxDesc), ((void const *)__pyx_v_cx), ((cudnnRNNDataDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), ((cudnnTensorDescriptor_t)__pyx_v_dhxDesc), ((void *)__pyx_v_dhx), ((cudnnTensorDescriptor_t)__pyx_v_dcxDesc), ((void *)__pyx_v_dcx), ((cudnnRNNDataDescriptor_t)__pyx_v_dkDesc), ((void *)__pyx_v_dkeys), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2325
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardDataEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2342
 *             <void*>workSpace, workSpaceSizeInBytes,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2315
 * 
 * 
 * cpdef RNNBackwardDataEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t yDesc, size_t y, size_t dyDesc,
 *         size_t dy, size_t dcDesc, size_t dcAttn, size_t dhyDesc, size_t dhy,
 */

  /* 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.cuda.cudnn.RNNBackwardDataEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_249RNNBackwardDataEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_248RNNBackwardDataEx[] = "RNNBackwardDataEx(intptr_t handle, size_t rnnDesc, size_t yDesc, size_t y, size_t dyDesc, size_t dy, size_t dcDesc, size_t dcAttn, size_t dhyDesc, size_t dhy, size_t dcyDesc, size_t dcy, size_t wDesc, size_t w, size_t hxDesc, size_t hx, size_t cxDesc, size_t cx, size_t dxDesc, size_t dx, size_t dhxDesc, size_t dhx, size_t dcxDesc, size_t dcx, size_t dkDesc, size_t dkeys, size_t workSpace, size_t workSpaceSizeInBytes, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_249RNNBackwardDataEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_dcDesc;
  size_t __pyx_v_dcAttn;
  size_t __pyx_v_dhyDesc;
  size_t __pyx_v_dhy;
  size_t __pyx_v_dcyDesc;
  size_t __pyx_v_dcy;
  size_t __pyx_v_wDesc;
  size_t __pyx_v_w;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_cxDesc;
  size_t __pyx_v_cx;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  size_t __pyx_v_dhxDesc;
  size_t __pyx_v_dhx;
  size_t __pyx_v_dcxDesc;
  size_t __pyx_v_dcx;
  size_t __pyx_v_dkDesc;
  size_t __pyx_v_dkeys;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNBackwardDataEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_dcDesc,&__pyx_n_s_dcAttn,&__pyx_n_s_dhyDesc,&__pyx_n_s_dhy,&__pyx_n_s_dcyDesc,&__pyx_n_s_dcy,&__pyx_n_s_wDesc,&__pyx_n_s_w,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_cxDesc,&__pyx_n_s_cx,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_dhxDesc,&__pyx_n_s_dhx,&__pyx_n_s_dcxDesc,&__pyx_n_s_dcx,&__pyx_n_s_dkDesc,&__pyx_n_s_dkeys,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[30] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 30: values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
        CYTHON_FALLTHROUGH;
        case 29: values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
        CYTHON_FALLTHROUGH;
        case 28: values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
        CYTHON_FALLTHROUGH;
        case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
        CYTHON_FALLTHROUGH;
        case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
        CYTHON_FALLTHROUGH;
        case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
        CYTHON_FALLTHROUGH;
        case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
        CYTHON_FALLTHROUGH;
        case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
        CYTHON_FALLTHROUGH;
        case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
        CYTHON_FALLTHROUGH;
        case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
        CYTHON_FALLTHROUGH;
        case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
        CYTHON_FALLTHROUGH;
        case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        CYTHON_FALLTHROUGH;
        case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
        CYTHON_FALLTHROUGH;
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 1); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 2); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 3); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 4); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 5); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 6); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcAttn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 7); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 8); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 9); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 10); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 11); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 12); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 13); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 14); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 15); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 16); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 17:
        if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 17); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 18:
        if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 18); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 19:
        if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 19); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 20:
        if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 20); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 21:
        if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dhx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 21); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 22:
        if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 22); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 23:
        if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dcx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 23); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 24:
        if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dkDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 24); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 25:
        if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dkeys)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 25); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 26:
        if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 26); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 27:
        if (likely((values[27] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 27); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 28:
        if (likely((values[28] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 28); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 29:
        if (likely((values[29] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, 29); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNBackwardDataEx") < 0)) __PYX_ERR(0, 2315, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 30) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
      values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
      values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
      values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
      values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
      values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
      values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
      values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
      values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
      values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
      values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
      values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
      values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
      values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
      values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
      values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
      values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2316, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2316, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2316, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2316, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2316, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L3_error)
    __pyx_v_dcDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dcDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L3_error)
    __pyx_v_dcAttn = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dcAttn == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L3_error)
    __pyx_v_dhyDesc = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_dhyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L3_error)
    __pyx_v_dhy = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_dhy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L3_error)
    __pyx_v_dcyDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_dcyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2318, __pyx_L3_error)
    __pyx_v_dcy = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_dcy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2318, __pyx_L3_error)
    __pyx_v_wDesc = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_wDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2318, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_w == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2318, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[14]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2318, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[15]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
    __pyx_v_cxDesc = __Pyx_PyInt_As_size_t(values[16]); if (unlikely((__pyx_v_cxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
    __pyx_v_cx = __Pyx_PyInt_As_size_t(values[17]); if (unlikely((__pyx_v_cx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[18]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[19]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
    __pyx_v_dhxDesc = __Pyx_PyInt_As_size_t(values[20]); if (unlikely((__pyx_v_dhxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2320, __pyx_L3_error)
    __pyx_v_dhx = __Pyx_PyInt_As_size_t(values[21]); if (unlikely((__pyx_v_dhx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2320, __pyx_L3_error)
    __pyx_v_dcxDesc = __Pyx_PyInt_As_size_t(values[22]); if (unlikely((__pyx_v_dcxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2320, __pyx_L3_error)
    __pyx_v_dcx = __Pyx_PyInt_As_size_t(values[23]); if (unlikely((__pyx_v_dcx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2320, __pyx_L3_error)
    __pyx_v_dkDesc = __Pyx_PyInt_As_size_t(values[24]); if (unlikely((__pyx_v_dkDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2321, __pyx_L3_error)
    __pyx_v_dkeys = __Pyx_PyInt_As_size_t(values[25]); if (unlikely((__pyx_v_dkeys == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2321, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[26]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2322, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[27]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2322, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[28]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2323, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[29]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2323, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNBackwardDataEx", 1, 30, 30, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2315, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNBackwardDataEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_248RNNBackwardDataEx(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dcDesc, __pyx_v_dcAttn, __pyx_v_dhyDesc, __pyx_v_dhy, __pyx_v_dcyDesc, __pyx_v_dcy, __pyx_v_wDesc, __pyx_v_w, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dhxDesc, __pyx_v_dhx, __pyx_v_dcxDesc, __pyx_v_dcx, __pyx_v_dkDesc, __pyx_v_dkeys, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_248RNNBackwardDataEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_dcDesc, size_t __pyx_v_dcAttn, size_t __pyx_v_dhyDesc, size_t __pyx_v_dhy, size_t __pyx_v_dcyDesc, size_t __pyx_v_dcy, size_t __pyx_v_wDesc, size_t __pyx_v_w, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_cxDesc, size_t __pyx_v_cx, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_dhxDesc, size_t __pyx_v_dhx, size_t __pyx_v_dcxDesc, size_t __pyx_v_dcx, size_t __pyx_v_dkDesc, size_t __pyx_v_dkeys, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardDataEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNBackwardDataEx(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_yDesc, __pyx_v_y, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_dcDesc, __pyx_v_dcAttn, __pyx_v_dhyDesc, __pyx_v_dhy, __pyx_v_dcyDesc, __pyx_v_dcy, __pyx_v_wDesc, __pyx_v_w, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_cxDesc, __pyx_v_cx, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_dhxDesc, __pyx_v_dhx, __pyx_v_dcxDesc, __pyx_v_dcx, __pyx_v_dkDesc, __pyx_v_dkeys, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2315, __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.cuda.cudnn.RNNBackwardDataEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2345
 * 
 * 
 * cpdef RNNBackwardWeightsEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t yDesc, size_t y,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_251RNNBackwardWeightsEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeightsEx(intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardWeightsEx", 0);

  /* "cupy/cuda/cudnn.pyx":2351
 *         size_t dwDesc, size_t dw,
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnRNNBackwardWeightsEx(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2352
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardWeightsEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2353
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnRNNBackwardWeightsEx(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 *             <RNNDataDescriptor>xDesc, <const void*>x,
 */
        __pyx_v_status = cudnnRNNBackwardWeightsEx(((cudnnHandle_t)__pyx_v_handle), ((cudnnRNNDescriptor_t)__pyx_v_rnnDesc), ((cudnnRNNDataDescriptor_t)__pyx_v_xDesc), ((void const *)__pyx_v_x), ((cudnnTensorDescriptor_t)__pyx_v_hxDesc), ((void const *)__pyx_v_hx), ((cudnnRNNDataDescriptor_t)__pyx_v_yDesc), ((void const *)__pyx_v_y), ((void *)__pyx_v_workSpace), __pyx_v_workSpaceSizeInBytes, ((cudnnFilterDescriptor_t)__pyx_v_dwDesc), ((void *)__pyx_v_dw), ((void *)__pyx_v_reserveSpace), __pyx_v_reserveSpaceSizeInBytes);
      }

      /* "cupy/cuda/cudnn.pyx":2352
 *         size_t reserveSpace, size_t reserveSpaceSizeInBytes):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnRNNBackwardWeightsEx(
 *             <Handle>handle, <RNNDescriptor>rnnDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2361
 *             <FilterDescriptor>dwDesc, <void*>dw,
 *             <void*>reserveSpace, reserveSpaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2345
 * 
 * 
 * cpdef RNNBackwardWeightsEx(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x,
 *         size_t hxDesc, size_t hx, size_t yDesc, size_t y,
 */

  /* 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.cuda.cudnn.RNNBackwardWeightsEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_251RNNBackwardWeightsEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_250RNNBackwardWeightsEx[] = "RNNBackwardWeightsEx(intptr_t handle, size_t rnnDesc, size_t xDesc, size_t x, size_t hxDesc, size_t hx, size_t yDesc, size_t y, size_t workSpace, size_t workSpaceSizeInBytes, size_t dwDesc, size_t dw, size_t reserveSpace, size_t reserveSpaceSizeInBytes)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_251RNNBackwardWeightsEx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_rnnDesc;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_hxDesc;
  size_t __pyx_v_hx;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  size_t __pyx_v_workSpace;
  size_t __pyx_v_workSpaceSizeInBytes;
  size_t __pyx_v_dwDesc;
  size_t __pyx_v_dw;
  size_t __pyx_v_reserveSpace;
  size_t __pyx_v_reserveSpaceSizeInBytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("RNNBackwardWeightsEx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_rnnDesc,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_hxDesc,&__pyx_n_s_hx,&__pyx_n_s_yDesc,&__pyx_n_s_y,&__pyx_n_s_workSpace,&__pyx_n_s_workSpaceSizeInBytes,&__pyx_n_s_dwDesc,&__pyx_n_s_dw,&__pyx_n_s_reserveSpace,&__pyx_n_s_reserveSpaceSizeInBytes,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnnDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 1); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 2); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 3); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 4); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 5); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 6); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 7); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 8); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_workSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 9); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dwDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 10); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 11); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpace)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 12); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reserveSpaceSizeInBytes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, 13); __PYX_ERR(0, 2345, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RNNBackwardWeightsEx") < 0)) __PYX_ERR(0, 2345, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 14) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    __pyx_v_rnnDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_rnnDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    __pyx_v_hxDesc = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_hxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2347, __pyx_L3_error)
    __pyx_v_hx = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_hx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2347, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2347, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2347, __pyx_L3_error)
    __pyx_v_workSpace = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_workSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2348, __pyx_L3_error)
    __pyx_v_workSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_workSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2348, __pyx_L3_error)
    __pyx_v_dwDesc = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_dwDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2349, __pyx_L3_error)
    __pyx_v_dw = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_dw == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2349, __pyx_L3_error)
    __pyx_v_reserveSpace = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_reserveSpace == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2350, __pyx_L3_error)
    __pyx_v_reserveSpaceSizeInBytes = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_reserveSpaceSizeInBytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2350, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("RNNBackwardWeightsEx", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.RNNBackwardWeightsEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_250RNNBackwardWeightsEx(__pyx_self, __pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_yDesc, __pyx_v_y, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_250RNNBackwardWeightsEx(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_rnnDesc, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_hxDesc, size_t __pyx_v_hx, size_t __pyx_v_yDesc, size_t __pyx_v_y, size_t __pyx_v_workSpace, size_t __pyx_v_workSpaceSizeInBytes, size_t __pyx_v_dwDesc, size_t __pyx_v_dw, size_t __pyx_v_reserveSpace, size_t __pyx_v_reserveSpaceSizeInBytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("RNNBackwardWeightsEx", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeightsEx(__pyx_v_handle, __pyx_v_rnnDesc, __pyx_v_xDesc, __pyx_v_x, __pyx_v_hxDesc, __pyx_v_hx, __pyx_v_yDesc, __pyx_v_y, __pyx_v_workSpace, __pyx_v_workSpaceSizeInBytes, __pyx_v_dwDesc, __pyx_v_dw, __pyx_v_reserveSpace, __pyx_v_reserveSpaceSizeInBytes, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2345, __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.cuda.cudnn.RNNBackwardWeightsEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2368
 * ###############################################################################
 * 
 * cpdef size_t createSpatialTransformerDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef SpatialTransformerDescriptor stDesc
 *     status = cudnnCreateSpatialTransformerDescriptor(&stDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_253createSpatialTransformerDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_4cupy_4cuda_5cudnn_createSpatialTransformerDescriptor(CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnSpatialTransformerDescriptor_t __pyx_v_stDesc;
  int __pyx_v_status;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createSpatialTransformerDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2370
 * cpdef size_t createSpatialTransformerDescriptor() except? 0:
 *     cdef SpatialTransformerDescriptor stDesc
 *     status = cudnnCreateSpatialTransformerDescriptor(&stDesc)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>stDesc
 */
  __pyx_v_status = cudnnCreateSpatialTransformerDescriptor((&__pyx_v_stDesc));

  /* "cupy/cuda/cudnn.pyx":2371
 *     cdef SpatialTransformerDescriptor stDesc
 *     status = cudnnCreateSpatialTransformerDescriptor(&stDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>stDesc
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2372
 *     status = cudnnCreateSpatialTransformerDescriptor(&stDesc)
 *     check_status(status)
 *     return <size_t>stDesc             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((size_t)__pyx_v_stDesc);
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2368
 * ###############################################################################
 * 
 * cpdef size_t createSpatialTransformerDescriptor() except? 0:             # <<<<<<<<<<<<<<
 *     cdef SpatialTransformerDescriptor stDesc
 *     status = cudnnCreateSpatialTransformerDescriptor(&stDesc)
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_253createSpatialTransformerDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_252createSpatialTransformerDescriptor[] = "createSpatialTransformerDescriptor() -> size_t";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_253createSpatialTransformerDescriptor(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createSpatialTransformerDescriptor (wrapper)", 0);
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_252createSpatialTransformerDescriptor(__pyx_self);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_252createSpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("createSpatialTransformerDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createSpatialTransformerDescriptor(0); if (unlikely(__pyx_t_1 == ((size_t)0) && PyErr_Occurred())) __PYX_ERR(0, 2368, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "cupy/cuda/cudnn.pyx":2375
 * 
 * 
 * cpdef destroySpatialTransformerDescriptor(size_t stDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroySpatialTransformerDescriptor(
 *         <SpatialTransformerDescriptor>stDesc)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_255destroySpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_stDesc); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroySpatialTransformerDescriptor(size_t __pyx_v_stDesc, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroySpatialTransformerDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2376
 * 
 * cpdef destroySpatialTransformerDescriptor(size_t stDesc):
 *     status = cudnnDestroySpatialTransformerDescriptor(             # <<<<<<<<<<<<<<
 *         <SpatialTransformerDescriptor>stDesc)
 *     check_status(status)
 */
  __pyx_v_status = cudnnDestroySpatialTransformerDescriptor(((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc));

  /* "cupy/cuda/cudnn.pyx":2378
 *     status = cudnnDestroySpatialTransformerDescriptor(
 *         <SpatialTransformerDescriptor>stDesc)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2375
 * 
 * 
 * cpdef destroySpatialTransformerDescriptor(size_t stDesc):             # <<<<<<<<<<<<<<
 *     status = cudnnDestroySpatialTransformerDescriptor(
 *         <SpatialTransformerDescriptor>stDesc)
 */

  /* 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.cuda.cudnn.destroySpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_255destroySpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_stDesc); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_254destroySpatialTransformerDescriptor[] = "destroySpatialTransformerDescriptor(size_t stDesc)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_255destroySpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_arg_stDesc) {
  size_t __pyx_v_stDesc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroySpatialTransformerDescriptor (wrapper)", 0);
  assert(__pyx_arg_stDesc); {
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(__pyx_arg_stDesc); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2375, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroySpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_254destroySpatialTransformerDescriptor(__pyx_self, ((size_t)__pyx_v_stDesc));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_254destroySpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_stDesc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroySpatialTransformerDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroySpatialTransformerDescriptor(__pyx_v_stDesc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2375, __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.cuda.cudnn.destroySpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2381
 * 
 * 
 * cpdef setSpatialTransformerDescriptor(             # <<<<<<<<<<<<<<
 *         size_t stDesc, size_t samplerType, int dataType,
 *         int nbDims, size_t dimA):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_257setSpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setSpatialTransformerDescriptor(size_t __pyx_v_stDesc, size_t __pyx_v_samplerType, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setSpatialTransformerDescriptor", 0);

  /* "cupy/cuda/cudnn.pyx":2384
 *         size_t stDesc, size_t samplerType, int dataType,
 *         int nbDims, size_t dimA):
 *     status = cudnnSetSpatialTransformerNdDescriptor(             # <<<<<<<<<<<<<<
 *         <SpatialTransformerDescriptor>stDesc, <SamplerType>samplerType,
 *         <DataType>dataType, nbDims, <int*>dimA)
 */
  __pyx_v_status = cudnnSetSpatialTransformerNdDescriptor(((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc), ((cudnnSamplerType_t)__pyx_v_samplerType), ((cudnnDataType_t)__pyx_v_dataType), __pyx_v_nbDims, ((int *)__pyx_v_dimA));

  /* "cupy/cuda/cudnn.pyx":2387
 *         <SpatialTransformerDescriptor>stDesc, <SamplerType>samplerType,
 *         <DataType>dataType, nbDims, <int*>dimA)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2381
 * 
 * 
 * cpdef setSpatialTransformerDescriptor(             # <<<<<<<<<<<<<<
 *         size_t stDesc, size_t samplerType, int dataType,
 *         int nbDims, size_t dimA):
 */

  /* 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.cuda.cudnn.setSpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_257setSpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_256setSpatialTransformerDescriptor[] = "setSpatialTransformerDescriptor(size_t stDesc, size_t samplerType, int dataType, int nbDims, size_t dimA)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_257setSpatialTransformerDescriptor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_stDesc;
  size_t __pyx_v_samplerType;
  int __pyx_v_dataType;
  int __pyx_v_nbDims;
  size_t __pyx_v_dimA;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setSpatialTransformerDescriptor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stDesc,&__pyx_n_s_samplerType,&__pyx_n_s_dataType,&__pyx_n_s_nbDims,&__pyx_n_s_dimA,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stDesc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplerType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSpatialTransformerDescriptor", 1, 5, 5, 1); __PYX_ERR(0, 2381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataType)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSpatialTransformerDescriptor", 1, 5, 5, 2); __PYX_ERR(0, 2381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbDims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSpatialTransformerDescriptor", 1, 5, 5, 3); __PYX_ERR(0, 2381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimA)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setSpatialTransformerDescriptor", 1, 5, 5, 4); __PYX_ERR(0, 2381, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSpatialTransformerDescriptor") < 0)) __PYX_ERR(0, 2381, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2382, __pyx_L3_error)
    __pyx_v_samplerType = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_samplerType == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2382, __pyx_L3_error)
    __pyx_v_dataType = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_dataType == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2382, __pyx_L3_error)
    __pyx_v_nbDims = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nbDims == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2383, __pyx_L3_error)
    __pyx_v_dimA = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_dimA == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2383, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setSpatialTransformerDescriptor", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2381, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setSpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_256setSpatialTransformerDescriptor(__pyx_self, __pyx_v_stDesc, __pyx_v_samplerType, __pyx_v_dataType, __pyx_v_nbDims, __pyx_v_dimA);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_256setSpatialTransformerDescriptor(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_stDesc, size_t __pyx_v_samplerType, int __pyx_v_dataType, int __pyx_v_nbDims, size_t __pyx_v_dimA) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setSpatialTransformerDescriptor", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setSpatialTransformerDescriptor(__pyx_v_stDesc, __pyx_v_samplerType, __pyx_v_dataType, __pyx_v_nbDims, __pyx_v_dimA, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2381, __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.cuda.cudnn.setSpatialTransformerDescriptor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2390
 * 
 * 
 * cpdef spatialTfGridGeneratorForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t theta, size_t grid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_259spatialTfGridGeneratorForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorForward(intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_theta, size_t __pyx_v_grid, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorForward", 0);

  /* "cupy/cuda/cudnn.pyx":2392
 * cpdef spatialTfGridGeneratorForward(
 *         intptr_t handle, size_t stDesc, size_t theta, size_t grid):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSpatialTfGridGeneratorForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2393
 *         intptr_t handle, size_t stDesc, size_t theta, size_t grid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfGridGeneratorForward(
 *             <Handle>handle, <SpatialTransformerDescriptor> stDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2394
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSpatialTfGridGeneratorForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SpatialTransformerDescriptor> stDesc,
 *             <void*>theta, <void*>grid)
 */
        __pyx_v_status = cudnnSpatialTfGridGeneratorForward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc), ((void *)__pyx_v_theta), ((void *)__pyx_v_grid));
      }

      /* "cupy/cuda/cudnn.pyx":2393
 *         intptr_t handle, size_t stDesc, size_t theta, size_t grid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfGridGeneratorForward(
 *             <Handle>handle, <SpatialTransformerDescriptor> stDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2397
 *             <Handle>handle, <SpatialTransformerDescriptor> stDesc,
 *             <void*>theta, <void*>grid)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2390
 * 
 * 
 * cpdef spatialTfGridGeneratorForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t theta, size_t grid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

  /* 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.cuda.cudnn.spatialTfGridGeneratorForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_259spatialTfGridGeneratorForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_258spatialTfGridGeneratorForward[] = "spatialTfGridGeneratorForward(intptr_t handle, size_t stDesc, size_t theta, size_t grid)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_259spatialTfGridGeneratorForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_stDesc;
  size_t __pyx_v_theta;
  size_t __pyx_v_grid;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_stDesc,&__pyx_n_s_theta,&__pyx_n_s_grid,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorForward", 1, 4, 4, 1); __PYX_ERR(0, 2390, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorForward", 1, 4, 4, 2); __PYX_ERR(0, 2390, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorForward", 1, 4, 4, 3); __PYX_ERR(0, 2390, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spatialTfGridGeneratorForward") < 0)) __PYX_ERR(0, 2390, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2391, __pyx_L3_error)
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2391, __pyx_L3_error)
    __pyx_v_theta = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_theta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2391, __pyx_L3_error)
    __pyx_v_grid = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_grid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2391, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorForward", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2390, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.spatialTfGridGeneratorForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_258spatialTfGridGeneratorForward(__pyx_self, __pyx_v_handle, __pyx_v_stDesc, __pyx_v_theta, __pyx_v_grid);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_258spatialTfGridGeneratorForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_theta, size_t __pyx_v_grid) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorForward(__pyx_v_handle, __pyx_v_stDesc, __pyx_v_theta, __pyx_v_grid, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2390, __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.cuda.cudnn.spatialTfGridGeneratorForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2400
 * 
 * 
 * cpdef spatialTfGridGeneratorBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_261spatialTfGridGeneratorBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorBackward(intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_dgrid, size_t __pyx_v_dtheta, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorBackward", 0);

  /* "cupy/cuda/cudnn.pyx":2402
 * cpdef spatialTfGridGeneratorBackward(
 *         intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSpatialTfGridGeneratorBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2403
 *         intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfGridGeneratorBackward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2404
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSpatialTfGridGeneratorBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 *             <void*>dgrid, <void*>dtheta)
 */
        __pyx_v_status = cudnnSpatialTfGridGeneratorBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc), ((void *)__pyx_v_dgrid), ((void *)__pyx_v_dtheta));
      }

      /* "cupy/cuda/cudnn.pyx":2403
 *         intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfGridGeneratorBackward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2407
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 *             <void*>dgrid, <void*>dtheta)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2400
 * 
 * 
 * cpdef spatialTfGridGeneratorBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

  /* 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.cuda.cudnn.spatialTfGridGeneratorBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_261spatialTfGridGeneratorBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_260spatialTfGridGeneratorBackward[] = "spatialTfGridGeneratorBackward(intptr_t handle, size_t stDesc, size_t dgrid, size_t dtheta)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_261spatialTfGridGeneratorBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_stDesc;
  size_t __pyx_v_dgrid;
  size_t __pyx_v_dtheta;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_stDesc,&__pyx_n_s_dgrid,&__pyx_n_s_dtheta,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorBackward", 1, 4, 4, 1); __PYX_ERR(0, 2400, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dgrid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorBackward", 1, 4, 4, 2); __PYX_ERR(0, 2400, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtheta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorBackward", 1, 4, 4, 3); __PYX_ERR(0, 2400, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spatialTfGridGeneratorBackward") < 0)) __PYX_ERR(0, 2400, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2401, __pyx_L3_error)
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2401, __pyx_L3_error)
    __pyx_v_dgrid = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_dgrid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2401, __pyx_L3_error)
    __pyx_v_dtheta = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_dtheta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2401, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("spatialTfGridGeneratorBackward", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2400, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.spatialTfGridGeneratorBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_260spatialTfGridGeneratorBackward(__pyx_self, __pyx_v_handle, __pyx_v_stDesc, __pyx_v_dgrid, __pyx_v_dtheta);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_260spatialTfGridGeneratorBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_dgrid, size_t __pyx_v_dtheta) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfGridGeneratorBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorBackward(__pyx_v_handle, __pyx_v_stDesc, __pyx_v_dgrid, __pyx_v_dtheta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2400, __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.cuda.cudnn.spatialTfGridGeneratorBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2410
 * 
 * 
 * cpdef spatialTfSamplerForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc,
 *         size_t x, size_t grid, size_t beta, size_t yDesc, size_t y):
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_263spatialTfSamplerForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerForward(intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_grid, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfSamplerForward", 0);

  /* "cupy/cuda/cudnn.pyx":2413
 *         intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc,
 *         size_t x, size_t grid, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSpatialTfSamplerForward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2414
 *         size_t x, size_t grid, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfSamplerForward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2415
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSpatialTfSamplerForward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 *             <void*>alpha, <TensorDescriptor>xDesc, <void*>x, <void*>grid,
 */
        __pyx_v_status = cudnnSpatialTfSamplerForward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((void *)__pyx_v_grid), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_yDesc), ((void *)__pyx_v_y));
      }

      /* "cupy/cuda/cudnn.pyx":2414
 *         size_t x, size_t grid, size_t beta, size_t yDesc, size_t y):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfSamplerForward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2419
 *             <void*>alpha, <TensorDescriptor>xDesc, <void*>x, <void*>grid,
 *             <void*>beta, <TensorDescriptor>yDesc, <void*>y)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2410
 * 
 * 
 * cpdef spatialTfSamplerForward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc,
 *         size_t x, size_t grid, size_t beta, size_t yDesc, size_t y):
 */

  /* 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.cuda.cudnn.spatialTfSamplerForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_263spatialTfSamplerForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_262spatialTfSamplerForward[] = "spatialTfSamplerForward(intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc, size_t x, size_t grid, size_t beta, size_t yDesc, size_t y)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_263spatialTfSamplerForward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_stDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_grid;
  size_t __pyx_v_beta;
  size_t __pyx_v_yDesc;
  size_t __pyx_v_y;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spatialTfSamplerForward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_stDesc,&__pyx_n_s_alpha,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_grid,&__pyx_n_s_beta,&__pyx_n_s_yDesc,&__pyx_n_s_y,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 1); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 2); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 3); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 4); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 5); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 6); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 7); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, 8); __PYX_ERR(0, 2410, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spatialTfSamplerForward") < 0)) __PYX_ERR(0, 2410, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error)
    __pyx_v_grid = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_grid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error)
    __pyx_v_yDesc = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_yDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error)
    __pyx_v_y = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2412, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("spatialTfSamplerForward", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2410, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.spatialTfSamplerForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_262spatialTfSamplerForward(__pyx_self, __pyx_v_handle, __pyx_v_stDesc, __pyx_v_alpha, __pyx_v_xDesc, __pyx_v_x, __pyx_v_grid, __pyx_v_beta, __pyx_v_yDesc, __pyx_v_y);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_262spatialTfSamplerForward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_grid, size_t __pyx_v_beta, size_t __pyx_v_yDesc, size_t __pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfSamplerForward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerForward(__pyx_v_handle, __pyx_v_stDesc, __pyx_v_alpha, __pyx_v_xDesc, __pyx_v_x, __pyx_v_grid, __pyx_v_beta, __pyx_v_yDesc, __pyx_v_y, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2410, __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.cuda.cudnn.spatialTfSamplerForward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2422
 * 
 * 
 * cpdef spatialTfSamplerBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc,
 *         size_t x, size_t beta, size_t dxDesc, size_t dx, size_t alphaDgrid,
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_265spatialTfSamplerBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerBackward(intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_beta, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_alphaDgrid, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_grid, size_t __pyx_v_betaDgrid, size_t __pyx_v_dgrid, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfSamplerBackward", 0);

  /* "cupy/cuda/cudnn.pyx":2426
 *         size_t x, size_t beta, size_t dxDesc, size_t dx, size_t alphaDgrid,
 *         size_t dyDesc, size_t dy, size_t grid, size_t betaDgrid, size_t dgrid):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnSpatialTfSamplerBackward(
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2427
 *         size_t dyDesc, size_t dy, size_t grid, size_t betaDgrid, size_t dgrid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfSamplerBackward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2428
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnSpatialTfSamplerBackward(             # <<<<<<<<<<<<<<
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 *             <void*>alpha, <TensorDescriptor>xDesc, <void*>x, <void*>beta,
 */
        __pyx_v_status = cudnnSpatialTfSamplerBackward(((cudnnHandle_t)__pyx_v_handle), ((cudnnSpatialTransformerDescriptor_t)__pyx_v_stDesc), ((void *)__pyx_v_alpha), ((cudnnTensorDescriptor_t)__pyx_v_xDesc), ((void *)__pyx_v_x), ((void *)__pyx_v_beta), ((cudnnTensorDescriptor_t)__pyx_v_dxDesc), ((void *)__pyx_v_dx), ((void *)__pyx_v_alphaDgrid), ((cudnnTensorDescriptor_t)__pyx_v_dyDesc), ((void *)__pyx_v_dy), ((void *)__pyx_v_grid), ((void *)__pyx_v_betaDgrid), ((void *)__pyx_v_dgrid));
      }

      /* "cupy/cuda/cudnn.pyx":2427
 *         size_t dyDesc, size_t dy, size_t grid, size_t betaDgrid, size_t dgrid):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSpatialTfSamplerBackward(
 *             <Handle>handle, <SpatialTransformerDescriptor>stDesc,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2434
 *             <TensorDescriptor>dyDesc, <void*>dy, <void*>grid,
 *             <void*>betaDgrid, <void*>dgrid)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * ###############################################################################
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2422
 * 
 * 
 * cpdef spatialTfSamplerBackward(             # <<<<<<<<<<<<<<
 *         intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc,
 *         size_t x, size_t beta, size_t dxDesc, size_t dx, size_t alphaDgrid,
 */

  /* 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.cuda.cudnn.spatialTfSamplerBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_265spatialTfSamplerBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_264spatialTfSamplerBackward[] = "spatialTfSamplerBackward(intptr_t handle, size_t stDesc, size_t alpha, size_t xDesc, size_t x, size_t beta, size_t dxDesc, size_t dx, size_t alphaDgrid, size_t dyDesc, size_t dy, size_t grid, size_t betaDgrid, size_t dgrid)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_265spatialTfSamplerBackward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_stDesc;
  size_t __pyx_v_alpha;
  size_t __pyx_v_xDesc;
  size_t __pyx_v_x;
  size_t __pyx_v_beta;
  size_t __pyx_v_dxDesc;
  size_t __pyx_v_dx;
  size_t __pyx_v_alphaDgrid;
  size_t __pyx_v_dyDesc;
  size_t __pyx_v_dy;
  size_t __pyx_v_grid;
  size_t __pyx_v_betaDgrid;
  size_t __pyx_v_dgrid;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spatialTfSamplerBackward (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_stDesc,&__pyx_n_s_alpha,&__pyx_n_s_xDesc,&__pyx_n_s_x,&__pyx_n_s_beta,&__pyx_n_s_dxDesc,&__pyx_n_s_dx,&__pyx_n_s_alphaDgrid,&__pyx_n_s_dyDesc,&__pyx_n_s_dy,&__pyx_n_s_grid,&__pyx_n_s_betaDgrid,&__pyx_n_s_dgrid,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 1); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 2); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 3); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 4); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 5); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dxDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 6); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 7); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alphaDgrid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 8); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dyDesc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 9); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 10); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 11); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_betaDgrid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 12); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dgrid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, 13); __PYX_ERR(0, 2422, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spatialTfSamplerBackward") < 0)) __PYX_ERR(0, 2422, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 14) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
      values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2423, __pyx_L3_error)
    __pyx_v_stDesc = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_stDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2423, __pyx_L3_error)
    __pyx_v_alpha = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_alpha == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2423, __pyx_L3_error)
    __pyx_v_xDesc = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_xDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2423, __pyx_L3_error)
    __pyx_v_x = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2424, __pyx_L3_error)
    __pyx_v_beta = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_beta == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2424, __pyx_L3_error)
    __pyx_v_dxDesc = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_dxDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2424, __pyx_L3_error)
    __pyx_v_dx = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_dx == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2424, __pyx_L3_error)
    __pyx_v_alphaDgrid = __Pyx_PyInt_As_size_t(values[8]); if (unlikely((__pyx_v_alphaDgrid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2424, __pyx_L3_error)
    __pyx_v_dyDesc = __Pyx_PyInt_As_size_t(values[9]); if (unlikely((__pyx_v_dyDesc == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L3_error)
    __pyx_v_dy = __Pyx_PyInt_As_size_t(values[10]); if (unlikely((__pyx_v_dy == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L3_error)
    __pyx_v_grid = __Pyx_PyInt_As_size_t(values[11]); if (unlikely((__pyx_v_grid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L3_error)
    __pyx_v_betaDgrid = __Pyx_PyInt_As_size_t(values[12]); if (unlikely((__pyx_v_betaDgrid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L3_error)
    __pyx_v_dgrid = __Pyx_PyInt_As_size_t(values[13]); if (unlikely((__pyx_v_dgrid == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("spatialTfSamplerBackward", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2422, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.spatialTfSamplerBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_264spatialTfSamplerBackward(__pyx_self, __pyx_v_handle, __pyx_v_stDesc, __pyx_v_alpha, __pyx_v_xDesc, __pyx_v_x, __pyx_v_beta, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_alphaDgrid, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_grid, __pyx_v_betaDgrid, __pyx_v_dgrid);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_264spatialTfSamplerBackward(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_stDesc, size_t __pyx_v_alpha, size_t __pyx_v_xDesc, size_t __pyx_v_x, size_t __pyx_v_beta, size_t __pyx_v_dxDesc, size_t __pyx_v_dx, size_t __pyx_v_alphaDgrid, size_t __pyx_v_dyDesc, size_t __pyx_v_dy, size_t __pyx_v_grid, size_t __pyx_v_betaDgrid, size_t __pyx_v_dgrid) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spatialTfSamplerBackward", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerBackward(__pyx_v_handle, __pyx_v_stDesc, __pyx_v_alpha, __pyx_v_xDesc, __pyx_v_x, __pyx_v_beta, __pyx_v_dxDesc, __pyx_v_dx, __pyx_v_alphaDgrid, __pyx_v_dyDesc, __pyx_v_dy, __pyx_v_grid, __pyx_v_betaDgrid, __pyx_v_dgrid, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2422, __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.cuda.cudnn.spatialTfSamplerBackward", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2440
 * ###############################################################################
 * 
 * cpdef createFusedOpsConstParamPack(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsConstParamPack constPack
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_267createFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsConstParamPack(int __pyx_v_ops, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnFusedOpsConstParamPack_t __pyx_v_constPack;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsConstParamPack", 0);

  /* "cupy/cuda/cudnn.pyx":2442
 * cpdef createFusedOpsConstParamPack(int ops):
 *     cdef FusedOpsConstParamPack constPack
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsConstParamPack(&constPack, <FusedOps>ops)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2443
 *     cdef FusedOpsConstParamPack constPack
 *     with nogil:
 *         status = cudnnCreateFusedOpsConstParamPack(&constPack, <FusedOps>ops)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>constPack
 */
        __pyx_v_status = cudnnCreateFusedOpsConstParamPack((&__pyx_v_constPack), ((cudnnFusedOps_t)__pyx_v_ops));
      }

      /* "cupy/cuda/cudnn.pyx":2442
 * cpdef createFusedOpsConstParamPack(int ops):
 *     cdef FusedOpsConstParamPack constPack
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsConstParamPack(&constPack, <FusedOps>ops)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2444
 *     with nogil:
 *         status = cudnnCreateFusedOpsConstParamPack(&constPack, <FusedOps>ops)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>constPack
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2445
 *         status = cudnnCreateFusedOpsConstParamPack(&constPack, <FusedOps>ops)
 *     check_status(status)
 *     return <size_t>constPack             # <<<<<<<<<<<<<<
 * 
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_constPack)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2440
 * ###############################################################################
 * 
 * cpdef createFusedOpsConstParamPack(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsConstParamPack constPack
 *     with nogil:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_267createFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_266createFusedOpsConstParamPack[] = "createFusedOpsConstParamPack(int ops)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_267createFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops) {
  int __pyx_v_ops;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createFusedOpsConstParamPack (wrapper)", 0);
  assert(__pyx_arg_ops); {
    __pyx_v_ops = __Pyx_PyInt_As_int(__pyx_arg_ops); if (unlikely((__pyx_v_ops == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2440, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.createFusedOpsConstParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_266createFusedOpsConstParamPack(__pyx_self, ((int)__pyx_v_ops));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_266createFusedOpsConstParamPack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsConstParamPack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createFusedOpsConstParamPack(__pyx_v_ops, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2440, __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.cuda.cudnn.createFusedOpsConstParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2447
 *     return <size_t>constPack
 * 
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsConstParamPack(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_269destroyFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_constPack); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsConstParamPack(size_t __pyx_v_constPack, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsConstParamPack", 0);

  /* "cupy/cuda/cudnn.pyx":2448
 * 
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsConstParamPack(
 *             <FusedOpsConstParamPack>constPack)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2449
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):
 *     with nogil:
 *         status = cudnnDestroyFusedOpsConstParamPack(             # <<<<<<<<<<<<<<
 *             <FusedOpsConstParamPack>constPack)
 *     check_status(status)
 */
        __pyx_v_status = cudnnDestroyFusedOpsConstParamPack(((cudnnFusedOpsConstParamPack_t)__pyx_v_constPack));
      }

      /* "cupy/cuda/cudnn.pyx":2448
 * 
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsConstParamPack(
 *             <FusedOpsConstParamPack>constPack)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2451
 *         status = cudnnDestroyFusedOpsConstParamPack(
 *             <FusedOpsConstParamPack>constPack)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2447
 *     return <size_t>constPack
 * 
 * cpdef destroyFusedOpsConstParamPack(size_t constPack):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsConstParamPack(
 */

  /* 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.cuda.cudnn.destroyFusedOpsConstParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_269destroyFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_constPack); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_268destroyFusedOpsConstParamPack[] = "destroyFusedOpsConstParamPack(size_t constPack)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_269destroyFusedOpsConstParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_constPack) {
  size_t __pyx_v_constPack;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyFusedOpsConstParamPack (wrapper)", 0);
  assert(__pyx_arg_constPack); {
    __pyx_v_constPack = __Pyx_PyInt_As_size_t(__pyx_arg_constPack); if (unlikely((__pyx_v_constPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2447, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyFusedOpsConstParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_268destroyFusedOpsConstParamPack(__pyx_self, ((size_t)__pyx_v_constPack));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_268destroyFusedOpsConstParamPack(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsConstParamPack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsConstParamPack(__pyx_v_constPack, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2447, __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.cuda.cudnn.destroyFusedOpsConstParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2453
 *     check_status(status)
 * 
 * cpdef setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                          size_t param):
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_271setFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsConstParamPackAttribute(size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFusedOpsConstParamPackAttribute", 0);

  /* "cupy/cuda/cudnn.pyx":2455
 * cpdef setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,
 *                                          size_t param):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetFusedOpsConstParamPackAttribute(
 *             <FusedOpsConstParamPack>constPack,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2456
 *                                          size_t param):
 *     with nogil:
 *         status = cudnnSetFusedOpsConstParamPackAttribute(             # <<<<<<<<<<<<<<
 *             <FusedOpsConstParamPack>constPack,
 *             <FusedOpsConstParamLabel>paramLabel, <const void*>param)
 */
        __pyx_v_status = cudnnSetFusedOpsConstParamPackAttribute(((cudnnFusedOpsConstParamPack_t)__pyx_v_constPack), ((cudnnFusedOpsConstParamLabel_t)__pyx_v_paramLabel), ((void const *)__pyx_v_param));
      }

      /* "cupy/cuda/cudnn.pyx":2455
 * cpdef setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,
 *                                          size_t param):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetFusedOpsConstParamPackAttribute(
 *             <FusedOpsConstParamPack>constPack,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2459
 *             <FusedOpsConstParamPack>constPack,
 *             <FusedOpsConstParamLabel>paramLabel, <const void*>param)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef getFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2453
 *     check_status(status)
 * 
 * cpdef setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                          size_t param):
 *     with nogil:
 */

  /* 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.cuda.cudnn.setFusedOpsConstParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_271setFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_270setFusedOpsConstParamPackAttribute[] = "setFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel, size_t param)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_271setFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_constPack;
  int __pyx_v_paramLabel;
  size_t __pyx_v_param;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFusedOpsConstParamPackAttribute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_constPack,&__pyx_n_s_paramLabel,&__pyx_n_s_param,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constPack)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramLabel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFusedOpsConstParamPackAttribute", 1, 3, 3, 1); __PYX_ERR(0, 2453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFusedOpsConstParamPackAttribute", 1, 3, 3, 2); __PYX_ERR(0, 2453, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFusedOpsConstParamPackAttribute") < 0)) __PYX_ERR(0, 2453, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_constPack = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_constPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2453, __pyx_L3_error)
    __pyx_v_paramLabel = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_paramLabel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2453, __pyx_L3_error)
    __pyx_v_param = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_param == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2454, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFusedOpsConstParamPackAttribute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setFusedOpsConstParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_270setFusedOpsConstParamPackAttribute(__pyx_self, __pyx_v_constPack, __pyx_v_paramLabel, __pyx_v_param);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_270setFusedOpsConstParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFusedOpsConstParamPackAttribute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setFusedOpsConstParamPackAttribute(__pyx_v_constPack, __pyx_v_paramLabel, __pyx_v_param, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2453, __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.cuda.cudnn.setFusedOpsConstParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2461
 *     check_status(status)
 * 
 * cpdef getFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                          size_t param):
 *     cdef int isNULL = 0
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_273getFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsConstParamPackAttribute(size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_isNULL;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFusedOpsConstParamPackAttribute", 0);

  /* "cupy/cuda/cudnn.pyx":2463
 * cpdef getFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,
 *                                          size_t param):
 *     cdef int isNULL = 0             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnGetFusedOpsConstParamPackAttribute(
 */
  __pyx_v_isNULL = 0;

  /* "cupy/cuda/cudnn.pyx":2464
 *                                          size_t param):
 *     cdef int isNULL = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnGetFusedOpsConstParamPackAttribute(
 *             <const FusedOpsConstParamPack>constPack,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2465
 *     cdef int isNULL = 0
 *     with nogil:
 *         status = cudnnGetFusedOpsConstParamPackAttribute(             # <<<<<<<<<<<<<<
 *             <const FusedOpsConstParamPack>constPack,
 *             <FusedOpsConstParamLabel>paramLabel, <void*>param, &isNULL)
 */
        __pyx_v_status = cudnnGetFusedOpsConstParamPackAttribute(((cudnnFusedOpsConstParamPack_t const )__pyx_v_constPack), ((cudnnFusedOpsConstParamLabel_t)__pyx_v_paramLabel), ((void *)__pyx_v_param), (&__pyx_v_isNULL));
      }

      /* "cupy/cuda/cudnn.pyx":2464
 *                                          size_t param):
 *     cdef int isNULL = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnGetFusedOpsConstParamPackAttribute(
 *             <const FusedOpsConstParamPack>constPack,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2468
 *             <const FusedOpsConstParamPack>constPack,
 *             <FusedOpsConstParamLabel>paramLabel, <void*>param, &isNULL)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return isNULL
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2469
 *             <FusedOpsConstParamLabel>paramLabel, <void*>param, &isNULL)
 *     check_status(status)
 *     return isNULL             # <<<<<<<<<<<<<<
 * 
 * cpdef createFusedOpsVariantParamPack(int ops):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_isNULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2461
 *     check_status(status)
 * 
 * cpdef getFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                          size_t param):
 *     cdef int isNULL = 0
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_273getFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_272getFusedOpsConstParamPackAttribute[] = "getFusedOpsConstParamPackAttribute(size_t constPack, int paramLabel, size_t param)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_273getFusedOpsConstParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_constPack;
  int __pyx_v_paramLabel;
  size_t __pyx_v_param;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFusedOpsConstParamPackAttribute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_constPack,&__pyx_n_s_paramLabel,&__pyx_n_s_param,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constPack)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramLabel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFusedOpsConstParamPackAttribute", 1, 3, 3, 1); __PYX_ERR(0, 2461, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_param)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFusedOpsConstParamPackAttribute", 1, 3, 3, 2); __PYX_ERR(0, 2461, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFusedOpsConstParamPackAttribute") < 0)) __PYX_ERR(0, 2461, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_constPack = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_constPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2461, __pyx_L3_error)
    __pyx_v_paramLabel = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_paramLabel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2461, __pyx_L3_error)
    __pyx_v_param = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_param == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2462, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFusedOpsConstParamPackAttribute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2461, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getFusedOpsConstParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_272getFusedOpsConstParamPackAttribute(__pyx_self, __pyx_v_constPack, __pyx_v_paramLabel, __pyx_v_param);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_272getFusedOpsConstParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_constPack, int __pyx_v_paramLabel, size_t __pyx_v_param) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFusedOpsConstParamPackAttribute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getFusedOpsConstParamPackAttribute(__pyx_v_constPack, __pyx_v_paramLabel, __pyx_v_param, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2461, __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.cuda.cudnn.getFusedOpsConstParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2471
 *     return isNULL
 * 
 * cpdef createFusedOpsVariantParamPack(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsVariantParamPack varPack
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_275createFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsVariantParamPack(int __pyx_v_ops, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnFusedOpsVariantParamPack_t __pyx_v_varPack;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsVariantParamPack", 0);

  /* "cupy/cuda/cudnn.pyx":2473
 * cpdef createFusedOpsVariantParamPack(int ops):
 *     cdef FusedOpsVariantParamPack varPack
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsVariantParamPack(&varPack, <FusedOps>ops)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2474
 *     cdef FusedOpsVariantParamPack varPack
 *     with nogil:
 *         status = cudnnCreateFusedOpsVariantParamPack(&varPack, <FusedOps>ops)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>varPack
 */
        __pyx_v_status = cudnnCreateFusedOpsVariantParamPack((&__pyx_v_varPack), ((cudnnFusedOps_t)__pyx_v_ops));
      }

      /* "cupy/cuda/cudnn.pyx":2473
 * cpdef createFusedOpsVariantParamPack(int ops):
 *     cdef FusedOpsVariantParamPack varPack
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsVariantParamPack(&varPack, <FusedOps>ops)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2475
 *     with nogil:
 *         status = cudnnCreateFusedOpsVariantParamPack(&varPack, <FusedOps>ops)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>varPack
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2476
 *         status = cudnnCreateFusedOpsVariantParamPack(&varPack, <FusedOps>ops)
 *     check_status(status)
 *     return <size_t>varPack             # <<<<<<<<<<<<<<
 * 
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_varPack)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2471
 *     return isNULL
 * 
 * cpdef createFusedOpsVariantParamPack(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsVariantParamPack varPack
 *     with nogil:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_275createFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_274createFusedOpsVariantParamPack[] = "createFusedOpsVariantParamPack(int ops)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_275createFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_ops) {
  int __pyx_v_ops;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createFusedOpsVariantParamPack (wrapper)", 0);
  assert(__pyx_arg_ops); {
    __pyx_v_ops = __Pyx_PyInt_As_int(__pyx_arg_ops); if (unlikely((__pyx_v_ops == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2471, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.createFusedOpsVariantParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_274createFusedOpsVariantParamPack(__pyx_self, ((int)__pyx_v_ops));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_274createFusedOpsVariantParamPack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsVariantParamPack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createFusedOpsVariantParamPack(__pyx_v_ops, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2471, __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.cuda.cudnn.createFusedOpsVariantParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2478
 *     return <size_t>varPack
 * 
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsVariantParamPack(
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_277destroyFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_varPack); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsVariantParamPack(size_t __pyx_v_varPack, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsVariantParamPack", 0);

  /* "cupy/cuda/cudnn.pyx":2479
 * 
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsVariantParamPack(
 *             <FusedOpsVariantParamPack>varPack)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2480
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):
 *     with nogil:
 *         status = cudnnDestroyFusedOpsVariantParamPack(             # <<<<<<<<<<<<<<
 *             <FusedOpsVariantParamPack>varPack)
 *     check_status(status)
 */
        __pyx_v_status = cudnnDestroyFusedOpsVariantParamPack(((cudnnFusedOpsVariantParamPack_t)__pyx_v_varPack));
      }

      /* "cupy/cuda/cudnn.pyx":2479
 * 
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsVariantParamPack(
 *             <FusedOpsVariantParamPack>varPack)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2482
 *         status = cudnnDestroyFusedOpsVariantParamPack(
 *             <FusedOpsVariantParamPack>varPack)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2478
 *     return <size_t>varPack
 * 
 * cpdef destroyFusedOpsVariantParamPack(size_t varPack):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsVariantParamPack(
 */

  /* 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.cuda.cudnn.destroyFusedOpsVariantParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_277destroyFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_varPack); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_276destroyFusedOpsVariantParamPack[] = "destroyFusedOpsVariantParamPack(size_t varPack)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_277destroyFusedOpsVariantParamPack(PyObject *__pyx_self, PyObject *__pyx_arg_varPack) {
  size_t __pyx_v_varPack;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyFusedOpsVariantParamPack (wrapper)", 0);
  assert(__pyx_arg_varPack); {
    __pyx_v_varPack = __Pyx_PyInt_As_size_t(__pyx_arg_varPack); if (unlikely((__pyx_v_varPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2478, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyFusedOpsVariantParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_276destroyFusedOpsVariantParamPack(__pyx_self, ((size_t)__pyx_v_varPack));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_276destroyFusedOpsVariantParamPack(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsVariantParamPack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsVariantParamPack(__pyx_v_varPack, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2478, __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.cuda.cudnn.destroyFusedOpsVariantParamPack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2484
 *     check_status(status)
 * 
 * cpdef setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                            size_t ptr):
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_279setFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsVariantParamPackAttribute(size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFusedOpsVariantParamPackAttribute", 0);

  /* "cupy/cuda/cudnn.pyx":2486
 * cpdef setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 *                                            size_t ptr):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetFusedOpsVariantParamPackAttribute(
 *             <FusedOpsVariantParamPack>varPack,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2487
 *                                            size_t ptr):
 *     with nogil:
 *         status = cudnnSetFusedOpsVariantParamPackAttribute(             # <<<<<<<<<<<<<<
 *             <FusedOpsVariantParamPack>varPack,
 *             <FusedOpsVariantParamLabel>paramLabel, <void*>ptr)
 */
        __pyx_v_status = cudnnSetFusedOpsVariantParamPackAttribute(((cudnnFusedOpsVariantParamPack_t)__pyx_v_varPack), ((cudnnFusedOpsVariantParamLabel_t)__pyx_v_paramLabel), ((void *)__pyx_v_ptr));
      }

      /* "cupy/cuda/cudnn.pyx":2486
 * cpdef setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 *                                            size_t ptr):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnSetFusedOpsVariantParamPackAttribute(
 *             <FusedOpsVariantParamPack>varPack,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2490
 *             <FusedOpsVariantParamPack>varPack,
 *             <FusedOpsVariantParamLabel>paramLabel, <void*>ptr)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2484
 *     check_status(status)
 * 
 * cpdef setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                            size_t ptr):
 *     with nogil:
 */

  /* 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.cuda.cudnn.setFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_279setFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_278setFusedOpsVariantParamPackAttribute[] = "setFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel, size_t ptr)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_279setFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_varPack;
  int __pyx_v_paramLabel;
  size_t __pyx_v_ptr;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setFusedOpsVariantParamPackAttribute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_varPack,&__pyx_n_s_paramLabel,&__pyx_n_s_ptr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_varPack)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramLabel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFusedOpsVariantParamPackAttribute", 1, 3, 3, 1); __PYX_ERR(0, 2484, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ptr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setFusedOpsVariantParamPackAttribute", 1, 3, 3, 2); __PYX_ERR(0, 2484, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setFusedOpsVariantParamPackAttribute") < 0)) __PYX_ERR(0, 2484, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_varPack = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_varPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2484, __pyx_L3_error)
    __pyx_v_paramLabel = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_paramLabel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2484, __pyx_L3_error)
    __pyx_v_ptr = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_ptr == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2485, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setFusedOpsVariantParamPackAttribute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2484, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.setFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_278setFusedOpsVariantParamPackAttribute(__pyx_self, __pyx_v_varPack, __pyx_v_paramLabel, __pyx_v_ptr);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_278setFusedOpsVariantParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("setFusedOpsVariantParamPackAttribute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setFusedOpsVariantParamPackAttribute(__pyx_v_varPack, __pyx_v_paramLabel, __pyx_v_ptr, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2484, __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.cuda.cudnn.setFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2492
 *     check_status(status)
 * 
 * cpdef getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                            size_t ptr):
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_281getFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsVariantParamPackAttribute(size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFusedOpsVariantParamPackAttribute", 0);

  /* "cupy/cuda/cudnn.pyx":2494
 * cpdef getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 *                                            size_t ptr):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnGetFusedOpsVariantParamPackAttribute(
 *             <const FusedOpsVariantParamPack>varPack,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2495
 *                                            size_t ptr):
 *     with nogil:
 *         status = cudnnGetFusedOpsVariantParamPackAttribute(             # <<<<<<<<<<<<<<
 *             <const FusedOpsVariantParamPack>varPack,
 *             <FusedOpsVariantParamLabel> paramLabel, <void*>ptr)
 */
        __pyx_v_status = cudnnGetFusedOpsVariantParamPackAttribute(((cudnnFusedOpsVariantParamPack_t const )__pyx_v_varPack), ((cudnnFusedOpsVariantParamLabel_t)__pyx_v_paramLabel), ((void *)__pyx_v_ptr));
      }

      /* "cupy/cuda/cudnn.pyx":2494
 * cpdef getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,
 *                                            size_t ptr):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnGetFusedOpsVariantParamPackAttribute(
 *             <const FusedOpsVariantParamPack>varPack,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2498
 *             <const FusedOpsVariantParamPack>varPack,
 *             <FusedOpsVariantParamLabel> paramLabel, <void*>ptr)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef createFusedOpsPlan(int ops):
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2492
 *     check_status(status)
 * 
 * cpdef getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel,             # <<<<<<<<<<<<<<
 *                                            size_t ptr):
 *     with nogil:
 */

  /* 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.cuda.cudnn.getFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_281getFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_280getFusedOpsVariantParamPackAttribute[] = "getFusedOpsVariantParamPackAttribute(size_t varPack, int paramLabel, size_t ptr)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_281getFusedOpsVariantParamPackAttribute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_varPack;
  int __pyx_v_paramLabel;
  size_t __pyx_v_ptr;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getFusedOpsVariantParamPackAttribute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_varPack,&__pyx_n_s_paramLabel,&__pyx_n_s_ptr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_varPack)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramLabel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFusedOpsVariantParamPackAttribute", 1, 3, 3, 1); __PYX_ERR(0, 2492, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ptr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("getFusedOpsVariantParamPackAttribute", 1, 3, 3, 2); __PYX_ERR(0, 2492, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFusedOpsVariantParamPackAttribute") < 0)) __PYX_ERR(0, 2492, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_varPack = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_varPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2492, __pyx_L3_error)
    __pyx_v_paramLabel = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_paramLabel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2492, __pyx_L3_error)
    __pyx_v_ptr = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_ptr == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2493, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFusedOpsVariantParamPackAttribute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2492, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.getFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_280getFusedOpsVariantParamPackAttribute(__pyx_self, __pyx_v_varPack, __pyx_v_paramLabel, __pyx_v_ptr);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_280getFusedOpsVariantParamPackAttribute(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_varPack, int __pyx_v_paramLabel, size_t __pyx_v_ptr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("getFusedOpsVariantParamPackAttribute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_getFusedOpsVariantParamPackAttribute(__pyx_v_varPack, __pyx_v_paramLabel, __pyx_v_ptr, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2492, __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.cuda.cudnn.getFusedOpsVariantParamPackAttribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2500
 *     check_status(status)
 * 
 * cpdef createFusedOpsPlan(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsPlan plan
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_283createFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsPlan(int __pyx_v_ops, CYTHON_UNUSED int __pyx_skip_dispatch) {
  cudnnFusedOpsPlan_t __pyx_v_plan;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2502
 * cpdef createFusedOpsPlan(int ops):
 *     cdef FusedOpsPlan plan
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsPlan(&plan, <FusedOps>ops)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2503
 *     cdef FusedOpsPlan plan
 *     with nogil:
 *         status = cudnnCreateFusedOpsPlan(&plan, <FusedOps>ops)             # <<<<<<<<<<<<<<
 *     check_status(status)
 *     return <size_t>plan
 */
        __pyx_v_status = cudnnCreateFusedOpsPlan((&__pyx_v_plan), ((cudnnFusedOps_t)__pyx_v_ops));
      }

      /* "cupy/cuda/cudnn.pyx":2502
 * cpdef createFusedOpsPlan(int ops):
 *     cdef FusedOpsPlan plan
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnCreateFusedOpsPlan(&plan, <FusedOps>ops)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2504
 *     with nogil:
 *         status = cudnnCreateFusedOpsPlan(&plan, <FusedOps>ops)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return <size_t>plan
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2505
 *         status = cudnnCreateFusedOpsPlan(&plan, <FusedOps>ops)
 *     check_status(status)
 *     return <size_t>plan             # <<<<<<<<<<<<<<
 * 
 * cpdef destroyFusedOpsPlan(size_t plan):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_plan)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2500
 *     check_status(status)
 * 
 * cpdef createFusedOpsPlan(int ops):             # <<<<<<<<<<<<<<
 *     cdef FusedOpsPlan plan
 *     with nogil:
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_283createFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_ops); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_282createFusedOpsPlan[] = "createFusedOpsPlan(int ops)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_283createFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_ops) {
  int __pyx_v_ops;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("createFusedOpsPlan (wrapper)", 0);
  assert(__pyx_arg_ops); {
    __pyx_v_ops = __Pyx_PyInt_As_int(__pyx_arg_ops); if (unlikely((__pyx_v_ops == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2500, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.createFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_282createFusedOpsPlan(__pyx_self, ((int)__pyx_v_ops));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_282createFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("createFusedOpsPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_createFusedOpsPlan(__pyx_v_ops, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2500, __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.cuda.cudnn.createFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2507
 *     return <size_t>plan
 * 
 * cpdef destroyFusedOpsPlan(size_t plan):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_285destroyFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsPlan(size_t __pyx_v_plan, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2508
 * 
 * cpdef destroyFusedOpsPlan(size_t plan):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)
 *     check_status(status)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2509
 * cpdef destroyFusedOpsPlan(size_t plan):
 *     with nogil:
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)             # <<<<<<<<<<<<<<
 *     check_status(status)
 * 
 */
        __pyx_v_status = cudnnDestroyFusedOpsPlan(((cudnnFusedOpsPlan_t)__pyx_v_plan));
      }

      /* "cupy/cuda/cudnn.pyx":2508
 * 
 * cpdef destroyFusedOpsPlan(size_t plan):
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)
 *     check_status(status)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2510
 *     with nogil:
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)
 *     check_status(status)             # <<<<<<<<<<<<<<
 * 
 * cpdef makeFusedOpsPlan(intptr_t handle, size_t plan, size_t constPack):
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2507
 *     return <size_t>plan
 * 
 * cpdef destroyFusedOpsPlan(size_t plan):             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnDestroyFusedOpsPlan(<FusedOpsPlan>plan)
 */

  /* 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.cuda.cudnn.destroyFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_285destroyFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_284destroyFusedOpsPlan[] = "destroyFusedOpsPlan(size_t plan)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_285destroyFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_arg_plan) {
  size_t __pyx_v_plan;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroyFusedOpsPlan (wrapper)", 0);
  assert(__pyx_arg_plan); {
    __pyx_v_plan = __Pyx_PyInt_As_size_t(__pyx_arg_plan); if (unlikely((__pyx_v_plan == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2507, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.destroyFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_284destroyFusedOpsPlan(__pyx_self, ((size_t)__pyx_v_plan));

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_284destroyFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_plan) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("destroyFusedOpsPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsPlan(__pyx_v_plan, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __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.cuda.cudnn.destroyFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2512
 *     check_status(status)
 * 
 * cpdef makeFusedOpsPlan(intptr_t handle, size_t plan, size_t constPack):             # <<<<<<<<<<<<<<
 *     cdef size_t workspaceSizeInBytes
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_287makeFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_makeFusedOpsPlan(intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_constPack, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_workspaceSizeInBytes;
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("makeFusedOpsPlan", 0);

  /* "cupy/cuda/cudnn.pyx":2514
 * cpdef makeFusedOpsPlan(intptr_t handle, size_t plan, size_t constPack):
 *     cdef size_t workspaceSizeInBytes
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnMakeFusedOpsPlan(<Handle>handle, <FusedOpsPlan>plan,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2515
 *     cdef size_t workspaceSizeInBytes
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnMakeFusedOpsPlan(<Handle>handle, <FusedOpsPlan>plan,
 *                                        <const FusedOpsConstParamPack>constPack,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2516
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnMakeFusedOpsPlan(<Handle>handle, <FusedOpsPlan>plan,             # <<<<<<<<<<<<<<
 *                                        <const FusedOpsConstParamPack>constPack,
 *                                        &workspaceSizeInBytes)
 */
        __pyx_v_status = cudnnMakeFusedOpsPlan(((cudnnHandle_t)__pyx_v_handle), ((cudnnFusedOpsPlan_t)__pyx_v_plan), ((cudnnFusedOpsConstParamPack_t const )__pyx_v_constPack), (&__pyx_v_workspaceSizeInBytes));
      }

      /* "cupy/cuda/cudnn.pyx":2515
 *     cdef size_t workspaceSizeInBytes
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnMakeFusedOpsPlan(<Handle>handle, <FusedOpsPlan>plan,
 *                                        <const FusedOpsConstParamPack>constPack,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2519
 *                                        <const FusedOpsConstParamPack>constPack,
 *                                        &workspaceSizeInBytes)
 *     check_status(status)             # <<<<<<<<<<<<<<
 *     return workspaceSizeInBytes
 * 
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2520
 *                                        &workspaceSizeInBytes)
 *     check_status(status)
 *     return workspaceSizeInBytes             # <<<<<<<<<<<<<<
 * 
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_workspaceSizeInBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cupy/cuda/cudnn.pyx":2512
 *     check_status(status)
 * 
 * cpdef makeFusedOpsPlan(intptr_t handle, size_t plan, size_t constPack):             # <<<<<<<<<<<<<<
 *     cdef size_t workspaceSizeInBytes
 *     setStream(handle, stream_module.get_current_stream_ptr())
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_287makeFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_286makeFusedOpsPlan[] = "makeFusedOpsPlan(intptr_t handle, size_t plan, size_t constPack)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_287makeFusedOpsPlan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_plan;
  size_t __pyx_v_constPack;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makeFusedOpsPlan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_plan,&__pyx_n_s_constPack,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_plan)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("makeFusedOpsPlan", 1, 3, 3, 1); __PYX_ERR(0, 2512, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_constPack)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("makeFusedOpsPlan", 1, 3, 3, 2); __PYX_ERR(0, 2512, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "makeFusedOpsPlan") < 0)) __PYX_ERR(0, 2512, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2512, __pyx_L3_error)
    __pyx_v_plan = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_plan == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2512, __pyx_L3_error)
    __pyx_v_constPack = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_constPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2512, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("makeFusedOpsPlan", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.makeFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_286makeFusedOpsPlan(__pyx_self, __pyx_v_handle, __pyx_v_plan, __pyx_v_constPack);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_286makeFusedOpsPlan(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_constPack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("makeFusedOpsPlan", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_makeFusedOpsPlan(__pyx_v_handle, __pyx_v_plan, __pyx_v_constPack, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2512, __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.cuda.cudnn.makeFusedOpsPlan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cupy/cuda/cudnn.pyx":2522
 *     return workspaceSizeInBytes
 * 
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_289fusedOpsExecute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4cupy_4cuda_5cudnn_fusedOpsExecute(intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_varPack, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_status;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("fusedOpsExecute", 0);

  /* "cupy/cuda/cudnn.pyx":2523
 * 
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):
 *     setStream(handle, stream_module.get_current_stream_ptr())             # <<<<<<<<<<<<<<
 *     with nogil:
 *         status = cudnnFusedOpsExecute(<Handle>handle, <const FusedOpsPlan>plan,
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_setStream(__pyx_v_handle, __pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr(), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2524
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnFusedOpsExecute(<Handle>handle, <const FusedOpsPlan>plan,
 *                                       <FusedOpsVariantParamPack>varPack)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "cupy/cuda/cudnn.pyx":2525
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 *         status = cudnnFusedOpsExecute(<Handle>handle, <const FusedOpsPlan>plan,             # <<<<<<<<<<<<<<
 *                                       <FusedOpsVariantParamPack>varPack)
 *     check_status(status)
 */
        __pyx_v_status = cudnnFusedOpsExecute(((cudnnHandle_t)__pyx_v_handle), ((cudnnFusedOpsPlan_t const )__pyx_v_plan), ((cudnnFusedOpsVariantParamPack_t)__pyx_v_varPack));
      }

      /* "cupy/cuda/cudnn.pyx":2524
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:             # <<<<<<<<<<<<<<
 *         status = cudnnFusedOpsExecute(<Handle>handle, <const FusedOpsPlan>plan,
 *                                       <FusedOpsVariantParamPack>varPack)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "cupy/cuda/cudnn.pyx":2527
 *         status = cudnnFusedOpsExecute(<Handle>handle, <const FusedOpsPlan>plan,
 *                                       <FusedOpsVariantParamPack>varPack)
 *     check_status(status)             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_check_status(__pyx_v_status, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":2522
 *     return workspaceSizeInBytes
 * 
 * cpdef fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack):             # <<<<<<<<<<<<<<
 *     setStream(handle, stream_module.get_current_stream_ptr())
 *     with nogil:
 */

  /* 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.cuda.cudnn.fusedOpsExecute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_289fusedOpsExecute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_288fusedOpsExecute[] = "fusedOpsExecute(intptr_t handle, size_t plan, size_t varPack)";
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_289fusedOpsExecute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  intptr_t __pyx_v_handle;
  size_t __pyx_v_plan;
  size_t __pyx_v_varPack;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fusedOpsExecute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handle,&__pyx_n_s_plan,&__pyx_n_s_varPack,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_plan)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fusedOpsExecute", 1, 3, 3, 1); __PYX_ERR(0, 2522, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_varPack)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fusedOpsExecute", 1, 3, 3, 2); __PYX_ERR(0, 2522, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fusedOpsExecute") < 0)) __PYX_ERR(0, 2522, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_handle = PyInt_AsSsize_t(values[0]); if (unlikely((__pyx_v_handle == ((intptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2522, __pyx_L3_error)
    __pyx_v_plan = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_plan == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2522, __pyx_L3_error)
    __pyx_v_varPack = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_varPack == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2522, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fusedOpsExecute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.fusedOpsExecute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_288fusedOpsExecute(__pyx_self, __pyx_v_handle, __pyx_v_plan, __pyx_v_varPack);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_288fusedOpsExecute(CYTHON_UNUSED PyObject *__pyx_self, intptr_t __pyx_v_handle, size_t __pyx_v_plan, size_t __pyx_v_varPack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("fusedOpsExecute", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_4cupy_4cuda_5cudnn_fusedOpsExecute(__pyx_v_handle, __pyx_v_plan, __pyx_v_varPack, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2522, __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.cuda.cudnn.fusedOpsExecute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_291__pyx_unpickle_CuDNNAlgoPerf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cupy_4cuda_5cudnn_290__pyx_unpickle_CuDNNAlgoPerf[] = "__pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_4cupy_4cuda_5cudnn_291__pyx_unpickle_CuDNNAlgoPerf = {"__pyx_unpickle_CuDNNAlgoPerf", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_291__pyx_unpickle_CuDNNAlgoPerf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_290__pyx_unpickle_CuDNNAlgoPerf};
static PyObject *__pyx_pw_4cupy_4cuda_5cudnn_291__pyx_unpickle_CuDNNAlgoPerf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_CuDNNAlgoPerf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CuDNNAlgoPerf", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CuDNNAlgoPerf", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_CuDNNAlgoPerf") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_CuDNNAlgoPerf", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cupy.cuda.cudnn.__pyx_unpickle_CuDNNAlgoPerf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4cupy_4cuda_5cudnn_290__pyx_unpickle_CuDNNAlgoPerf(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_4cupy_4cuda_5cudnn_290__pyx_unpickle_CuDNNAlgoPerf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = NULL;
  PyObject *__pyx_v___pyx_result = 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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CuDNNAlgoPerf", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x8e79936:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8e79936) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":4
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8e, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 4, __pyx_L1_error)

    /* "(tree fragment)":2
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x8e79936:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v___pyx_type);
      __Pyx_GIVEREF(__pyx_v___pyx_type);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":7
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_4cupy_4cuda_5cudnn___pyx_unpickle_CuDNNAlgoPerf__set_state(((struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8e79936 = (algo, determinism, mathType, memory, status, time))" % __pyx_checksum)
 *     __pyx_result = CuDNNAlgoPerf.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cupy.cuda.cudnn.__pyx_unpickle_CuDNNAlgoPerf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":9
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_4cupy_4cuda_5cudnn___pyx_unpickle_CuDNNAlgoPerf__set_state(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  size_t __pyx_t_3;
  float __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_CuDNNAlgoPerf__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->algo = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->determinism = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->mathType = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->memory = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->status = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->time = __pyx_t_4;

  /* "(tree fragment)":11
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(1, 11, __pyx_L1_error)
  }
  __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  __pyx_t_7 = ((__pyx_t_6 > 6) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "(tree fragment)":12
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[6])             # <<<<<<<<<<<<<<
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_update); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 12, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":11
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[6])
 */
  }

  /* "(tree fragment)":9
 *         __pyx_unpickle_CuDNNAlgoPerf__set_state(<CuDNNAlgoPerf> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_CuDNNAlgoPerf__set_state(CuDNNAlgoPerf __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.algo = __pyx_state[0]; __pyx_result.determinism = __pyx_state[1]; __pyx_result.mathType = __pyx_state[2]; __pyx_result.memory = __pyx_state[3]; __pyx_result.status = __pyx_state[4]; __pyx_result.time = __pyx_state[5]
 *     if len(__pyx_state) > 6 and hasattr(__pyx_result, '__dict__'):
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cupy.cuda.cudnn.__pyx_unpickle_CuDNNAlgoPerf__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_int", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

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

static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t(const std::vector<cudnnConvolutionFwdAlgoPerf_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert__to_py_cudnnConvolutionFwdAlgoPerf_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionFwdAlgoPerf_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

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

static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t(const std::vector<cudnnConvolutionBwdFilterAlgoPerf_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert__to_py_cudnnConvolutionBwdFilterAlgoPerf_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionBwdFilterAlgoPerf_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

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

static PyObject *__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(const std::vector<cudnnConvolutionBwdDataAlgoPerf_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t", 0);

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __pyx_convert__to_py_cudnnConvolutionBwdDataAlgoPerf_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

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

static PyObject *__pyx_tp_new_4cupy_4cuda_5cudnn_CuDNNAlgoPerf(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_4cupy_4cuda_5cudnn_CuDNNAlgoPerf(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_4cupy_4cuda_5cudnn_CuDNNAlgoPerf[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_3__reduce_cython__, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_2__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_5__setstate_cython__, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_4__setstate_cython__},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy.cuda.cudnn.CuDNNAlgoPerf", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn_CuDNNAlgoPerf), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_4cuda_5cudnn_CuDNNAlgoPerf, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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, /*tp_flags*/
  "CuDNNAlgoPerf(algo, status, time, memory, determinism, mathType)", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4cupy_4cuda_5cudnn_CuDNNAlgoPerf, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_4cupy_4cuda_5cudnn_13CuDNNAlgoPerf_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_4cuda_5cudnn_CuDNNAlgoPerf, /*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 PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *__pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct____str__[8];
static int __pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ = 0;

static PyObject *__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__)))) {
    o = (PyObject*)__pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct____str__[--__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct____str__];
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(PyObject *o) {
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *p = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__)))) {
    __pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct____str__[__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct____str__++] = ((struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *p = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4cupy_4cuda_5cudnn___pyx_scope_struct____str__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *p = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy.cuda.cudnn.__pyx_scope_struct____str__", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct____str__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_4cuda_5cudnn___pyx_scope_struct____str__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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_4cuda_5cudnn___pyx_scope_struct____str__, /*tp_traverse*/
  __pyx_tp_clear_4cupy_4cuda_5cudnn___pyx_scope_struct____str__, /*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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct____str__, /*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 PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *__pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr[--__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_info);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr[__pyx_freecount_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_info) {
    e = (*v)(p->__pyx_v_info, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cupy.cuda.cudnn.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  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_4cuda_5cudnn___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*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4cupy_4cuda_5cudnn___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 PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"check_status", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_1check_status, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_check_status},
  {"getVersion", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_5getVersion, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_4getVersion},
  {"queryRuntimeError", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_7queryRuntimeError, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_6queryRuntimeError},
  {"create", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_9create, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_8create},
  {"destroy", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_11destroy, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_10destroy},
  {"setStream", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_13setStream, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_12setStream},
  {"getStream", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_15getStream, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_14getStream},
  {"createTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_17createTensorDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_16createTensorDescriptor},
  {"setTensor4dDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_19setTensor4dDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_18setTensor4dDescriptor},
  {"setTensor4dDescriptorEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_21setTensor4dDescriptorEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_20setTensor4dDescriptorEx},
  {"getTensor4dDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_23getTensor4dDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_22getTensor4dDescriptor},
  {"setTensorNdDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_25setTensorNdDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_24setTensorNdDescriptor},
  {"destroyTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_27destroyTensorDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_26destroyTensorDescriptor},
  {"addTensor_v3", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_29addTensor_v3, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_28addTensor_v3},
  {"createOpTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_31createOpTensorDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_30createOpTensorDescriptor},
  {"setOpTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_33setOpTensorDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_32setOpTensorDescriptor},
  {"getOpTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_35getOpTensorDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_34getOpTensorDescriptor},
  {"destroyOpTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_37destroyOpTensorDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_36destroyOpTensorDescriptor},
  {"opTensor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_39opTensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_38opTensor},
  {"createReduceTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_41createReduceTensorDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_40createReduceTensorDescriptor},
  {"setReduceTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_43setReduceTensorDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_42setReduceTensorDescriptor},
  {"getReduceTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_45getReduceTensorDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_44getReduceTensorDescriptor},
  {"destroyReduceTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_47destroyReduceTensorDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_46destroyReduceTensorDescriptor},
  {"getReductionIndicesSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_49getReductionIndicesSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_48getReductionIndicesSize},
  {"getReductionWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_51getReductionWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_50getReductionWorkspaceSize},
  {"reduceTensor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_53reduceTensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_52reduceTensor},
  {"setTensor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_55setTensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_54setTensor},
  {"scaleTensor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_57scaleTensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_56scaleTensor},
  {"createFilterDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_59createFilterDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_58createFilterDescriptor},
  {"setFilter4dDescriptor_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_61setFilter4dDescriptor_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_60setFilter4dDescriptor_v4},
  {"setFilterNdDescriptor_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_63setFilterNdDescriptor_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_62setFilterNdDescriptor_v4},
  {"getFilterNdDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_65getFilterNdDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_64getFilterNdDescriptor},
  {"destroyFilterDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_67destroyFilterDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_66destroyFilterDescriptor},
  {"createConvolutionDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_69createConvolutionDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_68createConvolutionDescriptor},
  {"setConvolutionMathType", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_71setConvolutionMathType, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_70setConvolutionMathType},
  {"getConvolutionMathType", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_73getConvolutionMathType, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_72getConvolutionMathType},
  {"setConvolutionGroupCount", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_75setConvolutionGroupCount, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_74setConvolutionGroupCount},
  {"getConvolutionGroupCount", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_77getConvolutionGroupCount, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_76getConvolutionGroupCount},
  {"setConvolution2dDescriptor_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_79setConvolution2dDescriptor_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_78setConvolution2dDescriptor_v4},
  {"setConvolution2dDescriptor_v5", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_81setConvolution2dDescriptor_v5, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_80setConvolution2dDescriptor_v5},
  {"setConvolutionNdDescriptor_v3", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_83setConvolutionNdDescriptor_v3, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_82setConvolutionNdDescriptor_v3},
  {"destroyConvolutionDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_85destroyConvolutionDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_84destroyConvolutionDescriptor},
  {"findConvolutionForwardAlgorithm", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_87findConvolutionForwardAlgorithm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_86findConvolutionForwardAlgorithm},
  {"findConvolutionForwardAlgorithmEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_89findConvolutionForwardAlgorithmEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_88findConvolutionForwardAlgorithmEx},
  {"findConvolutionForwardAlgorithmEx_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_91findConvolutionForwardAlgorithmEx_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_90findConvolutionForwardAlgorithmEx_v7},
  {"getConvolutionForwardAlgorithm_v6", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_93getConvolutionForwardAlgorithm_v6, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_92getConvolutionForwardAlgorithm_v6},
  {"getConvolutionForwardAlgorithm_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_95getConvolutionForwardAlgorithm_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_94getConvolutionForwardAlgorithm_v7},
  {"getConvolutionForwardWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_97getConvolutionForwardWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_96getConvolutionForwardWorkspaceSize},
  {"convolutionForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_99convolutionForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_98convolutionForward},
  {"convolutionBackwardBias", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_101convolutionBackwardBias, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_100convolutionBackwardBias},
  {"findConvolutionBackwardFilterAlgorithm", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_103findConvolutionBackwardFilterAlgorithm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_102findConvolutionBackwardFilterAlgorithm},
  {"findConvolutionBackwardFilterAlgorithmEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_105findConvolutionBackwardFilterAlgorithmEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_104findConvolutionBackwardFilterAlgorithmEx},
  {"findConvolutionBackwardFilterAlgorithmEx_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_107findConvolutionBackwardFilterAlgorithmEx_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_106findConvolutionBackwardFilterAlgorithmEx_v7},
  {"getConvolutionBackwardFilterAlgorithm_v6", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_109getConvolutionBackwardFilterAlgorithm_v6, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_108getConvolutionBackwardFilterAlgorithm_v6},
  {"getConvolutionBackwardFilterAlgorithm_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_111getConvolutionBackwardFilterAlgorithm_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_110getConvolutionBackwardFilterAlgorithm_v7},
  {"getConvolutionBackwardFilterWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_113getConvolutionBackwardFilterWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_112getConvolutionBackwardFilterWorkspaceSize},
  {"convolutionBackwardFilter_v3", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_115convolutionBackwardFilter_v3, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_114convolutionBackwardFilter_v3},
  {"findConvolutionBackwardDataAlgorithm", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_117findConvolutionBackwardDataAlgorithm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_116findConvolutionBackwardDataAlgorithm},
  {"findConvolutionBackwardDataAlgorithmEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_119findConvolutionBackwardDataAlgorithmEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_118findConvolutionBackwardDataAlgorithmEx},
  {"findConvolutionBackwardDataAlgorithmEx_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_121findConvolutionBackwardDataAlgorithmEx_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_120findConvolutionBackwardDataAlgorithmEx_v7},
  {"getConvolutionBackwardDataAlgorithm_v6", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_123getConvolutionBackwardDataAlgorithm_v6, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_122getConvolutionBackwardDataAlgorithm_v6},
  {"getConvolutionBackwardDataAlgorithm_v7", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_125getConvolutionBackwardDataAlgorithm_v7, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_124getConvolutionBackwardDataAlgorithm_v7},
  {"getConvolutionBackwardDataWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_127getConvolutionBackwardDataWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_126getConvolutionBackwardDataWorkspaceSize},
  {"convolutionBackwardData_v3", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_129convolutionBackwardData_v3, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_128convolutionBackwardData_v3},
  {"createPoolingDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_131createPoolingDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_130createPoolingDescriptor},
  {"setPooling2dDescriptor_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_133setPooling2dDescriptor_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_132setPooling2dDescriptor_v4},
  {"setPoolingNdDescriptor_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_135setPoolingNdDescriptor_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_134setPoolingNdDescriptor_v4},
  {"destroyPoolingDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_137destroyPoolingDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_136destroyPoolingDescriptor},
  {"poolingForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_139poolingForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_138poolingForward},
  {"poolingBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_141poolingBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_140poolingBackward},
  {"deriveBNTensorDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_143deriveBNTensorDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_142deriveBNTensorDescriptor},
  {"batchNormalizationForwardTraining", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_145batchNormalizationForwardTraining, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_144batchNormalizationForwardTraining},
  {"batchNormalizationForwardInference", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_147batchNormalizationForwardInference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_146batchNormalizationForwardInference},
  {"batchNormalizationBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_149batchNormalizationBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_148batchNormalizationBackward},
  {"batchNormalizationForwardTrainingEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_151batchNormalizationForwardTrainingEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_150batchNormalizationForwardTrainingEx},
  {"getBatchNormalizationForwardTrainingExWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_153getBatchNormalizationForwardTrainingExWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_152getBatchNormalizationForwardTrainingExWorkspaceSize},
  {"batchNormalizationBackwardEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_155batchNormalizationBackwardEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_154batchNormalizationBackwardEx},
  {"getBatchNormalizationBackwardExWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_157getBatchNormalizationBackwardExWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_156getBatchNormalizationBackwardExWorkspaceSize},
  {"getBatchNormalizationTrainingExReserveSpaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_159getBatchNormalizationTrainingExReserveSpaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_158getBatchNormalizationTrainingExReserveSpaceSize},
  {"createActivationDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_161createActivationDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_160createActivationDescriptor},
  {"setActivationDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_163setActivationDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_162setActivationDescriptor},
  {"destroyActivationDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_165destroyActivationDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_164destroyActivationDescriptor},
  {"softmaxForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_167softmaxForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_166softmaxForward},
  {"softmaxBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_169softmaxBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_168softmaxBackward},
  {"activationForward_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_171activationForward_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_170activationForward_v4},
  {"activationBackward_v4", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_173activationBackward_v4, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_172activationBackward_v4},
  {"createDropoutDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_175createDropoutDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_174createDropoutDescriptor},
  {"destroyDropoutDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_177destroyDropoutDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_176destroyDropoutDescriptor},
  {"dropoutGetStatesSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_179dropoutGetStatesSize, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_178dropoutGetStatesSize},
  {"setDropoutDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_181setDropoutDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_180setDropoutDescriptor},
  {"getDropoutReserveSpaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_183getDropoutReserveSpaceSize, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_182getDropoutReserveSpaceSize},
  {"dropoutForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_185dropoutForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_184dropoutForward},
  {"dropoutBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_187dropoutBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_186dropoutBackward},
  {"createCTCLossDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_189createCTCLossDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_188createCTCLossDescriptor},
  {"destroyCTCLossDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_191destroyCTCLossDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_190destroyCTCLossDescriptor},
  {"setCTCLossDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_193setCTCLossDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_192setCTCLossDescriptor},
  {"getCTCLossDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_195getCTCLossDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_194getCTCLossDescriptor},
  {"getCTCLossWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_197getCTCLossWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_196getCTCLossWorkspaceSize},
  {"CTCLoss", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_199CTCLoss, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_198CTCLoss},
  {"createRNNDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_201createRNNDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_200createRNNDescriptor},
  {"destroyRNNDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_203destroyRNNDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_202destroyRNNDescriptor},
  {"createPersistentRNNPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_205createPersistentRNNPlan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_204createPersistentRNNPlan},
  {"setPersistentRNNPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_207setPersistentRNNPlan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_206setPersistentRNNPlan},
  {"destroyPersistentRNNPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_209destroyPersistentRNNPlan, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_208destroyPersistentRNNPlan},
  {"setRNNDescriptor_v5", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_211setRNNDescriptor_v5, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_210setRNNDescriptor_v5},
  {"setRNNDescriptor_v6", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_213setRNNDescriptor_v6, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_212setRNNDescriptor_v6},
  {"setRNNPaddingMode", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_215setRNNPaddingMode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_214setRNNPaddingMode},
  {"getRNNPaddingMode", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_217getRNNPaddingMode, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_216getRNNPaddingMode},
  {"createRNNDataDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_219createRNNDataDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_218createRNNDataDescriptor},
  {"destroyRNNDataDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_221destroyRNNDataDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_220destroyRNNDataDescriptor},
  {"setRNNDataDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_223setRNNDataDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_222setRNNDataDescriptor},
  {"getRNNDataDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_225getRNNDataDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_224getRNNDataDescriptor},
  {"getRNNWorkspaceSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_227getRNNWorkspaceSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_226getRNNWorkspaceSize},
  {"getRNNTrainingReserveSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_229getRNNTrainingReserveSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_228getRNNTrainingReserveSize},
  {"getRNNParamsSize", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_231getRNNParamsSize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_230getRNNParamsSize},
  {"getRNNLinLayerMatrixParams", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_233getRNNLinLayerMatrixParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_232getRNNLinLayerMatrixParams},
  {"getRNNLinLayerBiasParams", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_235getRNNLinLayerBiasParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_234getRNNLinLayerBiasParams},
  {"RNNForwardInference", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_237RNNForwardInference, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_236RNNForwardInference},
  {"RNNForwardTraining", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_239RNNForwardTraining, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_238RNNForwardTraining},
  {"RNNBackwardData", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_241RNNBackwardData, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_240RNNBackwardData},
  {"RNNBackwardWeights", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_243RNNBackwardWeights, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_242RNNBackwardWeights},
  {"RNNForwardInferenceEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_245RNNForwardInferenceEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_244RNNForwardInferenceEx},
  {"RNNForwardTrainingEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_247RNNForwardTrainingEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_246RNNForwardTrainingEx},
  {"RNNBackwardDataEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_249RNNBackwardDataEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_248RNNBackwardDataEx},
  {"RNNBackwardWeightsEx", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_251RNNBackwardWeightsEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_250RNNBackwardWeightsEx},
  {"createSpatialTransformerDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_253createSpatialTransformerDescriptor, METH_NOARGS, __pyx_doc_4cupy_4cuda_5cudnn_252createSpatialTransformerDescriptor},
  {"destroySpatialTransformerDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_255destroySpatialTransformerDescriptor, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_254destroySpatialTransformerDescriptor},
  {"setSpatialTransformerDescriptor", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_257setSpatialTransformerDescriptor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_256setSpatialTransformerDescriptor},
  {"spatialTfGridGeneratorForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_259spatialTfGridGeneratorForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_258spatialTfGridGeneratorForward},
  {"spatialTfGridGeneratorBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_261spatialTfGridGeneratorBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_260spatialTfGridGeneratorBackward},
  {"spatialTfSamplerForward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_263spatialTfSamplerForward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_262spatialTfSamplerForward},
  {"spatialTfSamplerBackward", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_265spatialTfSamplerBackward, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_264spatialTfSamplerBackward},
  {"createFusedOpsConstParamPack", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_267createFusedOpsConstParamPack, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_266createFusedOpsConstParamPack},
  {"destroyFusedOpsConstParamPack", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_269destroyFusedOpsConstParamPack, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_268destroyFusedOpsConstParamPack},
  {"setFusedOpsConstParamPackAttribute", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_271setFusedOpsConstParamPackAttribute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_270setFusedOpsConstParamPackAttribute},
  {"getFusedOpsConstParamPackAttribute", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_273getFusedOpsConstParamPackAttribute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_272getFusedOpsConstParamPackAttribute},
  {"createFusedOpsVariantParamPack", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_275createFusedOpsVariantParamPack, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_274createFusedOpsVariantParamPack},
  {"destroyFusedOpsVariantParamPack", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_277destroyFusedOpsVariantParamPack, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_276destroyFusedOpsVariantParamPack},
  {"setFusedOpsVariantParamPackAttribute", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_279setFusedOpsVariantParamPackAttribute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_278setFusedOpsVariantParamPackAttribute},
  {"getFusedOpsVariantParamPackAttribute", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_281getFusedOpsVariantParamPackAttribute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_280getFusedOpsVariantParamPackAttribute},
  {"createFusedOpsPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_283createFusedOpsPlan, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_282createFusedOpsPlan},
  {"destroyFusedOpsPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_285destroyFusedOpsPlan, METH_O, __pyx_doc_4cupy_4cuda_5cudnn_284destroyFusedOpsPlan},
  {"makeFusedOpsPlan", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_287makeFusedOpsPlan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_286makeFusedOpsPlan},
  {"fusedOpsExecute", (PyCFunction)__pyx_pw_4cupy_4cuda_5cudnn_289fusedOpsExecute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cupy_4cuda_5cudnn_288fusedOpsExecute},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_cudnn(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_cudnn},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "cudnn",
    __pyx_k_Thin_wrapper_of_cuDNN, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_CUDNN_BN_MIN_EPSILON, __pyx_k_CUDNN_BN_MIN_EPSILON, sizeof(__pyx_k_CUDNN_BN_MIN_EPSILON), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError, __pyx_k_CuDNNError, sizeof(__pyx_k_CuDNNError), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError___init, __pyx_k_CuDNNError___init, sizeof(__pyx_k_CuDNNError___init), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError___reduce, __pyx_k_CuDNNError___reduce, sizeof(__pyx_k_CuDNNError___reduce), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError___str, __pyx_k_CuDNNError___str, sizeof(__pyx_k_CuDNNError___str), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError___str___locals_genexp, __pyx_k_CuDNNError___str___locals_genexp, sizeof(__pyx_k_CuDNNError___str___locals_genexp), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError_add_info, __pyx_k_CuDNNError_add_info, sizeof(__pyx_k_CuDNNError_add_info), 0, 0, 1, 1},
  {&__pyx_n_s_CuDNNError_add_infos, __pyx_k_CuDNNError_add_infos, sizeof(__pyx_k_CuDNNError_add_infos), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x8e, __pyx_k_Incompatible_checksums_s_vs_0x8e, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8e), 0, 0, 1, 0},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_RNNDataDesc, __pyx_k_RNNDataDesc, sizeof(__pyx_k_RNNDataDesc), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
  {&__pyx_n_s_aDesc, __pyx_k_aDesc, sizeof(__pyx_k_aDesc), 0, 0, 1, 1},
  {&__pyx_n_s_activationDesc, __pyx_k_activationDesc, sizeof(__pyx_k_activationDesc), 0, 0, 1, 1},
  {&__pyx_n_s_add_info, __pyx_k_add_info, sizeof(__pyx_k_add_info), 0, 0, 1, 1},
  {&__pyx_n_s_add_infos, __pyx_k_add_infos, sizeof(__pyx_k_add_infos), 0, 0, 1, 1},
  {&__pyx_n_s_algo, __pyx_k_algo, sizeof(__pyx_k_algo), 0, 0, 1, 1},
  {&__pyx_n_s_algorithm, __pyx_k_algorithm, sizeof(__pyx_k_algorithm), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_alpha1, __pyx_k_alpha1, sizeof(__pyx_k_alpha1), 0, 0, 1, 1},
  {&__pyx_n_s_alpha2, __pyx_k_alpha2, sizeof(__pyx_k_alpha2), 0, 0, 1, 1},
  {&__pyx_n_s_alphaDataDiff, __pyx_k_alphaDataDiff, sizeof(__pyx_k_alphaDataDiff), 0, 0, 1, 1},
  {&__pyx_n_s_alphaDgrid, __pyx_k_alphaDgrid, sizeof(__pyx_k_alphaDgrid), 0, 0, 1, 1},
  {&__pyx_n_s_alphaParamDiff, __pyx_k_alphaParamDiff, sizeof(__pyx_k_alphaParamDiff), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_arrayLength, __pyx_k_arrayLength, sizeof(__pyx_k_arrayLength), 0, 0, 1, 1},
  {&__pyx_n_s_arrayLengthRequested, __pyx_k_arrayLengthRequested, sizeof(__pyx_k_arrayLengthRequested), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_bDesc, __pyx_k_bDesc, sizeof(__pyx_k_bDesc), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_batchSize, __pyx_k_batchSize, sizeof(__pyx_k_batchSize), 0, 0, 1, 1},
  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
  {&__pyx_n_s_betaDataDiff, __pyx_k_betaDataDiff, sizeof(__pyx_k_betaDataDiff), 0, 0, 1, 1},
  {&__pyx_n_s_betaDgrid, __pyx_k_betaDgrid, sizeof(__pyx_k_betaDgrid), 0, 0, 1, 1},
  {&__pyx_n_s_betaParamDiff, __pyx_k_betaParamDiff, sizeof(__pyx_k_betaParamDiff), 0, 0, 1, 1},
  {&__pyx_n_s_bnBias, __pyx_k_bnBias, sizeof(__pyx_k_bnBias), 0, 0, 1, 1},
  {&__pyx_n_s_bnBiasData, __pyx_k_bnBiasData, sizeof(__pyx_k_bnBiasData), 0, 0, 1, 1},
  {&__pyx_n_s_bnOps, __pyx_k_bnOps, sizeof(__pyx_k_bnOps), 0, 0, 1, 1},
  {&__pyx_n_s_bnScale, __pyx_k_bnScale, sizeof(__pyx_k_bnScale), 0, 0, 1, 1},
  {&__pyx_n_s_bnScaleBiasMeanVarDesc, __pyx_k_bnScaleBiasMeanVarDesc, sizeof(__pyx_k_bnScaleBiasMeanVarDesc), 0, 0, 1, 1},
  {&__pyx_n_s_bnScaleData, __pyx_k_bnScaleData, sizeof(__pyx_k_bnScaleData), 0, 0, 1, 1},
  {&__pyx_n_s_bnops, __pyx_k_bnops, sizeof(__pyx_k_bnops), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_cAttn, __pyx_k_cAttn, sizeof(__pyx_k_cAttn), 0, 0, 1, 1},
  {&__pyx_n_s_cDesc, __pyx_k_cDesc, sizeof(__pyx_k_cDesc), 0, 0, 1, 1},
  {&__pyx_n_s_cStride, __pyx_k_cStride, sizeof(__pyx_k_cStride), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_computeType, __pyx_k_computeType, sizeof(__pyx_k_computeType), 0, 0, 1, 1},
  {&__pyx_n_s_constPack, __pyx_k_constPack, sizeof(__pyx_k_constPack), 0, 0, 1, 1},
  {&__pyx_n_s_convDesc, __pyx_k_convDesc, sizeof(__pyx_k_convDesc), 0, 0, 1, 1},
  {&__pyx_n_s_costs, __pyx_k_costs, sizeof(__pyx_k_costs), 0, 0, 1, 1},
  {&__pyx_n_s_ctcLossDesc, __pyx_k_ctcLossDesc, sizeof(__pyx_k_ctcLossDesc), 0, 0, 1, 1},
  {&__pyx_kp_u_cuDNN_Error, __pyx_k_cuDNN_Error, sizeof(__pyx_k_cuDNN_Error), 0, 1, 0, 0},
  {&__pyx_n_s_cupy_cuda_cudnn, __pyx_k_cupy_cuda_cudnn, sizeof(__pyx_k_cupy_cuda_cudnn), 0, 0, 1, 1},
  {&__pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_k_cupy_cuda_cudnn_pyx, sizeof(__pyx_k_cupy_cuda_cudnn_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_cx, __pyx_k_cx, sizeof(__pyx_k_cx), 0, 0, 1, 1},
  {&__pyx_n_s_cxDesc, __pyx_k_cxDesc, sizeof(__pyx_k_cxDesc), 0, 0, 1, 1},
  {&__pyx_n_s_cy, __pyx_k_cy, sizeof(__pyx_k_cy), 0, 0, 1, 1},
  {&__pyx_n_s_cyDesc, __pyx_k_cyDesc, sizeof(__pyx_k_cyDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dBnBiasData, __pyx_k_dBnBiasData, sizeof(__pyx_k_dBnBiasData), 0, 0, 1, 1},
  {&__pyx_n_s_dBnBiasResult, __pyx_k_dBnBiasResult, sizeof(__pyx_k_dBnBiasResult), 0, 0, 1, 1},
  {&__pyx_n_s_dBnScaleBiasDesc, __pyx_k_dBnScaleBiasDesc, sizeof(__pyx_k_dBnScaleBiasDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dBnScaleData, __pyx_k_dBnScaleData, sizeof(__pyx_k_dBnScaleData), 0, 0, 1, 1},
  {&__pyx_n_s_dBnScaleResult, __pyx_k_dBnScaleResult, sizeof(__pyx_k_dBnScaleResult), 0, 0, 1, 1},
  {&__pyx_n_s_dataType, __pyx_k_dataType, sizeof(__pyx_k_dataType), 0, 0, 1, 1},
  {&__pyx_n_s_dcAttn, __pyx_k_dcAttn, sizeof(__pyx_k_dcAttn), 0, 0, 1, 1},
  {&__pyx_n_s_dcDesc, __pyx_k_dcDesc, sizeof(__pyx_k_dcDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dcx, __pyx_k_dcx, sizeof(__pyx_k_dcx), 0, 0, 1, 1},
  {&__pyx_n_s_dcxDesc, __pyx_k_dcxDesc, sizeof(__pyx_k_dcxDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dcy, __pyx_k_dcy, sizeof(__pyx_k_dcy), 0, 0, 1, 1},
  {&__pyx_n_s_dcyDesc, __pyx_k_dcyDesc, sizeof(__pyx_k_dcyDesc), 0, 0, 1, 1},
  {&__pyx_n_s_derivedBnDesc, __pyx_k_derivedBnDesc, sizeof(__pyx_k_derivedBnDesc), 0, 0, 1, 1},
  {&__pyx_n_s_destData, __pyx_k_destData, sizeof(__pyx_k_destData), 0, 0, 1, 1},
  {&__pyx_n_s_destDesc, __pyx_k_destDesc, sizeof(__pyx_k_destDesc), 0, 0, 1, 1},
  {&__pyx_n_s_destDiffData, __pyx_k_destDiffData, sizeof(__pyx_k_destDiffData), 0, 0, 1, 1},
  {&__pyx_n_s_destDiffDesc, __pyx_k_destDiffDesc, sizeof(__pyx_k_destDiffDesc), 0, 0, 1, 1},
  {&__pyx_n_s_determinism, __pyx_k_determinism, sizeof(__pyx_k_determinism), 0, 0, 1, 1},
  {&__pyx_n_s_dgrid, __pyx_k_dgrid, sizeof(__pyx_k_dgrid), 0, 0, 1, 1},
  {&__pyx_n_s_dhx, __pyx_k_dhx, sizeof(__pyx_k_dhx), 0, 0, 1, 1},
  {&__pyx_n_s_dhxDesc, __pyx_k_dhxDesc, sizeof(__pyx_k_dhxDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dhy, __pyx_k_dhy, sizeof(__pyx_k_dhy), 0, 0, 1, 1},
  {&__pyx_n_s_dhyDesc, __pyx_k_dhyDesc, sizeof(__pyx_k_dhyDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_diffData, __pyx_k_diffData, sizeof(__pyx_k_diffData), 0, 0, 1, 1},
  {&__pyx_n_s_diffDesc, __pyx_k_diffDesc, sizeof(__pyx_k_diffDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dilationA, __pyx_k_dilationA, sizeof(__pyx_k_dilationA), 0, 0, 1, 1},
  {&__pyx_n_s_dilation_h, __pyx_k_dilation_h, sizeof(__pyx_k_dilation_h), 0, 0, 1, 1},
  {&__pyx_n_s_dilation_w, __pyx_k_dilation_w, sizeof(__pyx_k_dilation_w), 0, 0, 1, 1},
  {&__pyx_n_s_dimA, __pyx_k_dimA, sizeof(__pyx_k_dimA), 0, 0, 1, 1},
  {&__pyx_n_s_direction, __pyx_k_direction, sizeof(__pyx_k_direction), 0, 0, 1, 1},
  {&__pyx_n_s_dkDesc, __pyx_k_dkDesc, sizeof(__pyx_k_dkDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dkeys, __pyx_k_dkeys, sizeof(__pyx_k_dkeys), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dropout, __pyx_k_dropout, sizeof(__pyx_k_dropout), 0, 0, 1, 1},
  {&__pyx_n_s_dropoutDesc, __pyx_k_dropoutDesc, sizeof(__pyx_k_dropoutDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dstData, __pyx_k_dstData, sizeof(__pyx_k_dstData), 0, 0, 1, 1},
  {&__pyx_n_s_dstDesc, __pyx_k_dstDesc, sizeof(__pyx_k_dstDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dtheta, __pyx_k_dtheta, sizeof(__pyx_k_dtheta), 0, 0, 1, 1},
  {&__pyx_n_s_dw, __pyx_k_dw, sizeof(__pyx_k_dw), 0, 0, 1, 1},
  {&__pyx_n_s_dwDesc, __pyx_k_dwDesc, sizeof(__pyx_k_dwDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_dxData, __pyx_k_dxData, sizeof(__pyx_k_dxData), 0, 0, 1, 1},
  {&__pyx_n_s_dxDesc, __pyx_k_dxDesc, sizeof(__pyx_k_dxDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1},
  {&__pyx_n_s_dyData, __pyx_k_dyData, sizeof(__pyx_k_dyData), 0, 0, 1, 1},
  {&__pyx_n_s_dyDesc, __pyx_k_dyDesc, sizeof(__pyx_k_dyDesc), 0, 0, 1, 1},
  {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1},
  {&__pyx_n_s_dzDesc, __pyx_k_dzDesc, sizeof(__pyx_k_dzDesc), 0, 0, 1, 1},
  {&__pyx_n_s_epsilon, __pyx_k_epsilon, sizeof(__pyx_k_epsilon), 0, 0, 1, 1},
  {&__pyx_n_s_estimatedMean, __pyx_k_estimatedMean, sizeof(__pyx_k_estimatedMean), 0, 0, 1, 1},
  {&__pyx_n_s_estimatedVariance, __pyx_k_estimatedVariance, sizeof(__pyx_k_estimatedVariance), 0, 0, 1, 1},
  {&__pyx_n_s_exponentialAverageFactor, __pyx_k_exponentialAverageFactor, sizeof(__pyx_k_exponentialAverageFactor), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_filterData, __pyx_k_filterData, sizeof(__pyx_k_filterData), 0, 0, 1, 1},
  {&__pyx_n_s_filterDesc, __pyx_k_filterDesc, sizeof(__pyx_k_filterDesc), 0, 0, 1, 1},
  {&__pyx_n_s_filterDimA, __pyx_k_filterDimA, sizeof(__pyx_k_filterDimA), 0, 0, 1, 1},
  {&__pyx_n_s_filterStrideA, __pyx_k_filterStrideA, sizeof(__pyx_k_filterStrideA), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get_build_version, __pyx_k_get_build_version, sizeof(__pyx_k_get_build_version), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_gradData, __pyx_k_gradData, sizeof(__pyx_k_gradData), 0, 0, 1, 1},
  {&__pyx_n_s_gradDesc, __pyx_k_gradDesc, sizeof(__pyx_k_gradDesc), 0, 0, 1, 1},
  {&__pyx_n_s_gradients, __pyx_k_gradients, sizeof(__pyx_k_gradients), 0, 0, 1, 1},
  {&__pyx_n_s_gradientsDesc, __pyx_k_gradientsDesc, sizeof(__pyx_k_gradientsDesc), 0, 0, 1, 1},
  {&__pyx_n_s_grid, __pyx_k_grid, sizeof(__pyx_k_grid), 0, 0, 1, 1},
  {&__pyx_n_s_groupCount, __pyx_k_groupCount, sizeof(__pyx_k_groupCount), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_hStride, __pyx_k_hStride, sizeof(__pyx_k_hStride), 0, 0, 1, 1},
  {&__pyx_n_s_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 0, 0, 1, 1},
  {&__pyx_n_s_hiddenSize, __pyx_k_hiddenSize, sizeof(__pyx_k_hiddenSize), 0, 0, 1, 1},
  {&__pyx_n_s_horizontalPadding, __pyx_k_horizontalPadding, sizeof(__pyx_k_horizontalPadding), 0, 0, 1, 1},
  {&__pyx_n_s_horizontalStride, __pyx_k_horizontalStride, sizeof(__pyx_k_horizontalStride), 0, 0, 1, 1},
  {&__pyx_n_s_hx, __pyx_k_hx, sizeof(__pyx_k_hx), 0, 0, 1, 1},
  {&__pyx_n_s_hxDesc, __pyx_k_hxDesc, sizeof(__pyx_k_hxDesc), 0, 0, 1, 1},
  {&__pyx_n_s_hy, __pyx_k_hy, sizeof(__pyx_k_hy), 0, 0, 1, 1},
  {&__pyx_n_s_hyDesc, __pyx_k_hyDesc, sizeof(__pyx_k_hyDesc), 0, 0, 1, 1},
  {&__pyx_n_s_iAttn, __pyx_k_iAttn, sizeof(__pyx_k_iAttn), 0, 0, 1, 1},
  {&__pyx_n_s_iDesc, __pyx_k_iDesc, sizeof(__pyx_k_iDesc), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_indicesSizeInBytes, __pyx_k_indicesSizeInBytes, sizeof(__pyx_k_indicesSizeInBytes), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_infos, __pyx_k_infos, sizeof(__pyx_k_infos), 0, 0, 1, 1},
  {&__pyx_n_s_infos_2, __pyx_k_infos_2, sizeof(__pyx_k_infos_2), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_inputLengths, __pyx_k_inputLengths, sizeof(__pyx_k_inputLengths), 0, 0, 1, 1},
  {&__pyx_n_s_inputMode, __pyx_k_inputMode, sizeof(__pyx_k_inputMode), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_kDesc, __pyx_k_kDesc, sizeof(__pyx_k_kDesc), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_labelLengths, __pyx_k_labelLengths, sizeof(__pyx_k_labelLengths), 0, 0, 1, 1},
  {&__pyx_n_s_labels, __pyx_k_labels, sizeof(__pyx_k_labels), 0, 0, 1, 1},
  {&__pyx_n_s_layer, __pyx_k_layer, sizeof(__pyx_k_layer), 0, 0, 1, 1},
  {&__pyx_n_s_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 0, 0, 1, 1},
  {&__pyx_n_s_linLayerBias, __pyx_k_linLayerBias, sizeof(__pyx_k_linLayerBias), 0, 0, 1, 1},
  {&__pyx_n_s_linLayerBiasDesc, __pyx_k_linLayerBiasDesc, sizeof(__pyx_k_linLayerBiasDesc), 0, 0, 1, 1},
  {&__pyx_n_s_linLayerID, __pyx_k_linLayerID, sizeof(__pyx_k_linLayerID), 0, 0, 1, 1},
  {&__pyx_n_s_linLayerMat, __pyx_k_linLayerMat, sizeof(__pyx_k_linLayerMat), 0, 0, 1, 1},
  {&__pyx_n_s_linLayerMatDesc, __pyx_k_linLayerMatDesc, sizeof(__pyx_k_linLayerMatDesc), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_mathType, __pyx_k_mathType, sizeof(__pyx_k_mathType), 0, 0, 1, 1},
  {&__pyx_n_s_maxSeqLength, __pyx_k_maxSeqLength, sizeof(__pyx_k_maxSeqLength), 0, 0, 1, 1},
  {&__pyx_n_s_maxpoolingNanOpt, __pyx_k_maxpoolingNanOpt, sizeof(__pyx_k_maxpoolingNanOpt), 0, 0, 1, 1},
  {&__pyx_n_s_memory, __pyx_k_memory, sizeof(__pyx_k_memory), 0, 0, 1, 1},
  {&__pyx_n_s_memoryLimitInbytes, __pyx_k_memoryLimitInbytes, sizeof(__pyx_k_memoryLimitInbytes), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_minibatch, __pyx_k_minibatch, sizeof(__pyx_k_minibatch), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_nStride, __pyx_k_nStride, sizeof(__pyx_k_nStride), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_nbDims, __pyx_k_nbDims, sizeof(__pyx_k_nbDims), 0, 0, 1, 1},
  {&__pyx_n_s_nbDimsRequested, __pyx_k_nbDimsRequested, sizeof(__pyx_k_nbDimsRequested), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_numLayers, __pyx_k_numLayers, sizeof(__pyx_k_numLayers), 0, 0, 1, 1},
  {&__pyx_n_s_opTensorCompType, __pyx_k_opTensorCompType, sizeof(__pyx_k_opTensorCompType), 0, 0, 1, 1},
  {&__pyx_n_s_opTensorDesc, __pyx_k_opTensorDesc, sizeof(__pyx_k_opTensorDesc), 0, 0, 1, 1},
  {&__pyx_n_s_opTensorNanOpt, __pyx_k_opTensorNanOpt, sizeof(__pyx_k_opTensorNanOpt), 0, 0, 1, 1},
  {&__pyx_n_s_opTensorOp, __pyx_k_opTensorOp, sizeof(__pyx_k_opTensorOp), 0, 0, 1, 1},
  {&__pyx_n_s_padA, __pyx_k_padA, sizeof(__pyx_k_padA), 0, 0, 1, 1},
  {&__pyx_n_s_pad_h, __pyx_k_pad_h, sizeof(__pyx_k_pad_h), 0, 0, 1, 1},
  {&__pyx_n_s_pad_w, __pyx_k_pad_w, sizeof(__pyx_k_pad_w), 0, 0, 1, 1},
  {&__pyx_n_s_paddingA, __pyx_k_paddingA, sizeof(__pyx_k_paddingA), 0, 0, 1, 1},
  {&__pyx_n_s_paddingFill, __pyx_k_paddingFill, sizeof(__pyx_k_paddingFill), 0, 0, 1, 1},
  {&__pyx_n_s_paddingMode, __pyx_k_paddingMode, sizeof(__pyx_k_paddingMode), 0, 0, 1, 1},
  {&__pyx_n_s_param, __pyx_k_param, sizeof(__pyx_k_param), 0, 0, 1, 1},
  {&__pyx_n_s_paramLabel, __pyx_k_paramLabel, sizeof(__pyx_k_paramLabel), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_plan, __pyx_k_plan, sizeof(__pyx_k_plan), 0, 0, 1, 1},
  {&__pyx_n_s_poolingDesc, __pyx_k_poolingDesc, sizeof(__pyx_k_poolingDesc), 0, 0, 1, 1},
  {&__pyx_n_s_preference, __pyx_k_preference, sizeof(__pyx_k_preference), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_probs, __pyx_k_probs, sizeof(__pyx_k_probs), 0, 0, 1, 1},
  {&__pyx_n_s_probsDesc, __pyx_k_probsDesc, sizeof(__pyx_k_probsDesc), 0, 0, 1, 1},
  {&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_CuDNNAlgoPerf, __pyx_k_pyx_unpickle_CuDNNAlgoPerf, sizeof(__pyx_k_pyx_unpickle_CuDNNAlgoPerf), 0, 0, 1, 1},
  {&__pyx_n_s_qDesc, __pyx_k_qDesc, sizeof(__pyx_k_qDesc), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_queries, __pyx_k_queries, sizeof(__pyx_k_queries), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorCompType, __pyx_k_reduceTensorCompType, sizeof(__pyx_k_reduceTensorCompType), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorDesc, __pyx_k_reduceTensorDesc, sizeof(__pyx_k_reduceTensorDesc), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorIndices, __pyx_k_reduceTensorIndices, sizeof(__pyx_k_reduceTensorIndices), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorIndicesType, __pyx_k_reduceTensorIndicesType, sizeof(__pyx_k_reduceTensorIndicesType), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorNanOpt, __pyx_k_reduceTensorNanOpt, sizeof(__pyx_k_reduceTensorNanOpt), 0, 0, 1, 1},
  {&__pyx_n_s_reduceTensorOp, __pyx_k_reduceTensorOp, sizeof(__pyx_k_reduceTensorOp), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reluCeiling, __pyx_k_reluCeiling, sizeof(__pyx_k_reluCeiling), 0, 0, 1, 1},
  {&__pyx_n_s_reluNanOpt, __pyx_k_reluNanOpt, sizeof(__pyx_k_reluNanOpt), 0, 0, 1, 1},
  {&__pyx_n_s_requestedAlgoCount, __pyx_k_requestedAlgoCount, sizeof(__pyx_k_requestedAlgoCount), 0, 0, 1, 1},
  {&__pyx_n_s_reserveSpace, __pyx_k_reserveSpace, sizeof(__pyx_k_reserveSpace), 0, 0, 1, 1},
  {&__pyx_n_s_reserveSpaceSizeInBytes, __pyx_k_reserveSpaceSizeInBytes, sizeof(__pyx_k_reserveSpaceSizeInBytes), 0, 0, 1, 1},
  {&__pyx_n_s_resultRunningMean, __pyx_k_resultRunningMean, sizeof(__pyx_k_resultRunningMean), 0, 0, 1, 1},
  {&__pyx_n_s_resultRunningVariance, __pyx_k_resultRunningVariance, sizeof(__pyx_k_resultRunningVariance), 0, 0, 1, 1},
  {&__pyx_n_s_resultSaveInvVariance, __pyx_k_resultSaveInvVariance, sizeof(__pyx_k_resultSaveInvVariance), 0, 0, 1, 1},
  {&__pyx_n_s_resultSaveMean, __pyx_k_resultSaveMean, sizeof(__pyx_k_resultSaveMean), 0, 0, 1, 1},
  {&__pyx_n_s_rnnDesc, __pyx_k_rnnDesc, sizeof(__pyx_k_rnnDesc), 0, 0, 1, 1},
  {&__pyx_n_s_samplerType, __pyx_k_samplerType, sizeof(__pyx_k_samplerType), 0, 0, 1, 1},
  {&__pyx_n_s_savedInvVariance, __pyx_k_savedInvVariance, sizeof(__pyx_k_savedInvVariance), 0, 0, 1, 1},
  {&__pyx_n_s_savedMean, __pyx_k_savedMean, sizeof(__pyx_k_savedMean), 0, 0, 1, 1},
  {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_seqLength, __pyx_k_seqLength, sizeof(__pyx_k_seqLength), 0, 0, 1, 1},
  {&__pyx_n_s_seqLengthArray, __pyx_k_seqLengthArray, sizeof(__pyx_k_seqLengthArray), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_srcData, __pyx_k_srcData, sizeof(__pyx_k_srcData), 0, 0, 1, 1},
  {&__pyx_n_s_srcDesc, __pyx_k_srcDesc, sizeof(__pyx_k_srcDesc), 0, 0, 1, 1},
  {&__pyx_n_s_srcDiffData, __pyx_k_srcDiffData, sizeof(__pyx_k_srcDiffData), 0, 0, 1, 1},
  {&__pyx_n_s_srcDiffDesc, __pyx_k_srcDiffDesc, sizeof(__pyx_k_srcDiffDesc), 0, 0, 1, 1},
  {&__pyx_n_s_stDesc, __pyx_k_stDesc, sizeof(__pyx_k_stDesc), 0, 0, 1, 1},
  {&__pyx_n_s_stateSizeInBytes, __pyx_k_stateSizeInBytes, sizeof(__pyx_k_stateSizeInBytes), 0, 0, 1, 1},
  {&__pyx_n_s_states, __pyx_k_states, sizeof(__pyx_k_states), 0, 0, 1, 1},
  {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1},
  {&__pyx_n_s_strideA, __pyx_k_strideA, sizeof(__pyx_k_strideA), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_tensorDesc, __pyx_k_tensorDesc, sizeof(__pyx_k_tensorDesc), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_valuePtr, __pyx_k_valuePtr, sizeof(__pyx_k_valuePtr), 0, 0, 1, 1},
  {&__pyx_n_s_varPack, __pyx_k_varPack, sizeof(__pyx_k_varPack), 0, 0, 1, 1},
  {&__pyx_n_s_vectorSize, __pyx_k_vectorSize, sizeof(__pyx_k_vectorSize), 0, 0, 1, 1},
  {&__pyx_n_s_verticalPadding, __pyx_k_verticalPadding, sizeof(__pyx_k_verticalPadding), 0, 0, 1, 1},
  {&__pyx_n_s_verticalStride, __pyx_k_verticalStride, sizeof(__pyx_k_verticalStride), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_wDesc, __pyx_k_wDesc, sizeof(__pyx_k_wDesc), 0, 0, 1, 1},
  {&__pyx_n_s_wStride, __pyx_k_wStride, sizeof(__pyx_k_wStride), 0, 0, 1, 1},
  {&__pyx_n_s_windowDimA, __pyx_k_windowDimA, sizeof(__pyx_k_windowDimA), 0, 0, 1, 1},
  {&__pyx_n_s_windowHeight, __pyx_k_windowHeight, sizeof(__pyx_k_windowHeight), 0, 0, 1, 1},
  {&__pyx_n_s_windowWidth, __pyx_k_windowWidth, sizeof(__pyx_k_windowWidth), 0, 0, 1, 1},
  {&__pyx_n_s_workSpace, __pyx_k_workSpace, sizeof(__pyx_k_workSpace), 0, 0, 1, 1},
  {&__pyx_n_s_workSpaceSizeInBytes, __pyx_k_workSpaceSizeInBytes, sizeof(__pyx_k_workSpaceSizeInBytes), 0, 0, 1, 1},
  {&__pyx_n_s_workspace, __pyx_k_workspace, sizeof(__pyx_k_workspace), 0, 0, 1, 1},
  {&__pyx_n_s_workspaceSizeInBytes, __pyx_k_workspaceSizeInBytes, sizeof(__pyx_k_workspaceSizeInBytes), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xDesc, __pyx_k_xDesc, sizeof(__pyx_k_xDesc), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_yDesc, __pyx_k_yDesc, sizeof(__pyx_k_yDesc), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {&__pyx_n_s_zDesc, __pyx_k_zDesc, sizeof(__pyx_k_zDesc), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 756, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 761, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 61, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cupy/cuda/cudnn.pyx":756
 * ###############################################################################
 * 
 * class CuDNNError(RuntimeError):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, int status):
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "cupy/cuda/cudnn.pyx":758
 * class CuDNNError(RuntimeError):
 * 
 *     def __init__(self, int status):             # <<<<<<<<<<<<<<
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)
 */
  __pyx_tuple__4 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_status, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_init, 758, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 758, __pyx_L1_error)

  /* "cupy/cuda/cudnn.pyx":765
 *         self._infos = []
 * 
 *     def add_info(self, info):             # <<<<<<<<<<<<<<
 *         assert isinstance(info, str)
 *         self._infos.append(info)
 */
  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_info); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_add_info, 765, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 765, __pyx_L1_error)

  /* "cupy/cuda/cudnn.pyx":769
 *         self._infos.append(info)
 * 
 *     def add_infos(self, infos):             # <<<<<<<<<<<<<<
 *         assert isinstance(infos, list)
 *         self._infos.extend(infos)
 */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_infos_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_add_infos, 769, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 769, __pyx_L1_error)

  /* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */
  __pyx_tuple__10 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_base, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_str, 773, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 773, __pyx_L1_error)

  /* "cupy/cuda/cudnn.pyx":778
 *             '\n  ' + info for info in self._infos)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (type(self), (self.status,))
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_reduce, 778, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 778, __pyx_L1_error)

  /* "cupy/cuda/cudnn.pyx":792
 * ###############################################################################
 * 
 * def get_build_version():             # <<<<<<<<<<<<<<
 *     return CUDNN_VERSION
 * 
 */
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cupy_cuda_cudnn_pyx, __pyx_n_s_get_build_version, 792, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 792, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_tuple__15 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_CuDNNAlgoPerf, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_149395766 = PyInt_FromLong(149395766L); if (unlikely(!__pyx_int_149395766)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_modinit_global_init_code(void); /*proto*/
static int __Pyx_modinit_variable_export_code(void); /*proto*/
static int __Pyx_modinit_function_export_code(void); /*proto*/
static int __Pyx_modinit_type_init_code(void); /*proto*/
static int __Pyx_modinit_type_import_code(void); /*proto*/
static int __Pyx_modinit_variable_import_code(void); /*proto*/
static int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("getVersion", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getVersion, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("queryRuntimeError", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_queryRuntimeError, "PyObject *(intptr_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("create", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_create, "intptr_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroy", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroy, "PyObject *(intptr_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setStream", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setStream, "PyObject *(intptr_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getStream", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getStream, "size_t (intptr_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createTensorDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setTensor4dDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptor, "PyObject *(size_t, int, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setTensor4dDescriptorEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setTensor4dDescriptorEx, "PyObject *(size_t, int, int, int, int, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getTensor4dDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getTensor4dDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setTensorNdDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setTensorNdDescriptor, "PyObject *(size_t, int, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyTensorDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("addTensor_v3", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_addTensor_v3, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createOpTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createOpTensorDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setOpTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setOpTensorDescriptor, "PyObject *(size_t, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getOpTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getOpTensorDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyOpTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyOpTensorDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("opTensor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_opTensor, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createReduceTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createReduceTensorDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setReduceTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setReduceTensorDescriptor, "PyObject *(size_t, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getReduceTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getReduceTensorDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyReduceTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyReduceTensorDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getReductionIndicesSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getReductionIndicesSize, "size_t (intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getReductionWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getReductionWorkspaceSize, "size_t (intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("reduceTensor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_reduceTensor, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setTensor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setTensor, "PyObject *(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("scaleTensor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_scaleTensor, "PyObject *(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createFilterDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createFilterDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setFilter4dDescriptor_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setFilter4dDescriptor_v4, "PyObject *(size_t, int, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setFilterNdDescriptor_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setFilterNdDescriptor_v4, "PyObject *(size_t, int, int, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getFilterNdDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getFilterNdDescriptor, "PyObject *(size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyFilterDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyFilterDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createConvolutionDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createConvolutionDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setConvolutionMathType", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setConvolutionMathType, "PyObject *(size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionMathType", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionMathType, "size_t (size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setConvolutionGroupCount", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setConvolutionGroupCount, "PyObject *(size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionGroupCount", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionGroupCount, "int (size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setConvolution2dDescriptor_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v4, "PyObject *(size_t, int, int, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setConvolution2dDescriptor_v5", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setConvolution2dDescriptor_v5, "PyObject *(size_t, int, int, int, int, int, int, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setConvolutionNdDescriptor_v3", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setConvolutionNdDescriptor_v3, "PyObject *(size_t, int, size_t, size_t, size_t, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyConvolutionDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyConvolutionDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionForwardAlgorithm", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithm, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionForwardAlgorithmEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionForwardAlgorithmEx_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionForwardAlgorithmEx_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionForwardAlgorithm_v6", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v6, "int (intptr_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionForwardAlgorithm_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardAlgorithm_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionForwardWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionForwardWorkspaceSize, "Py_ssize_t (intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("convolutionForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_convolutionForward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("convolutionBackwardBias", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardBias, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardFilterAlgorithm", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithm, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardFilterAlgorithmEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardFilterAlgorithmEx_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardFilterAlgorithmEx_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardFilterAlgorithm_v6", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v6, "int (intptr_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardFilterAlgorithm_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterAlgorithm_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardFilterWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardFilterWorkspaceSize, "Py_ssize_t (intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("convolutionBackwardFilter_v3", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardFilter_v3, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardDataAlgorithm", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithm, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardDataAlgorithmEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("findConvolutionBackwardDataAlgorithmEx_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_findConvolutionBackwardDataAlgorithmEx_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardDataAlgorithm_v6", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v6, "int (intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardDataAlgorithm_v7", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataAlgorithm_v7, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getConvolutionBackwardDataWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getConvolutionBackwardDataWorkspaceSize, "Py_ssize_t (intptr_t, size_t, size_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("convolutionBackwardData_v3", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_convolutionBackwardData_v3, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createPoolingDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createPoolingDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setPooling2dDescriptor_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setPooling2dDescriptor_v4, "PyObject *(size_t, int, int, int, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setPoolingNdDescriptor_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setPoolingNdDescriptor_v4, "PyObject *(size_t, int, int, int, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyPoolingDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyPoolingDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("poolingForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_poolingForward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("poolingBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_poolingBackward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("deriveBNTensorDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_deriveBNTensorDescriptor, "PyObject *(size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("batchNormalizationForwardTraining", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTraining, "PyObject *(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, double, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("batchNormalizationForwardInference", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardInference, "PyObject *(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("batchNormalizationBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackward, "PyObject *(intptr_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("batchNormalizationForwardTrainingEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationForwardTrainingEx, "PyObject *(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, double, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getBatchNormalizationForwardTrainingExWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationForwardTrainingExWorkspaceSize, "size_t (intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("batchNormalizationBackwardEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_batchNormalizationBackwardEx, "PyObject *(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, double, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getBatchNormalizationBackwardExWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationBackwardExWorkspaceSize, "size_t (intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getBatchNormalizationTrainingExReserveSpaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getBatchNormalizationTrainingExReserveSpaceSize, "size_t (intptr_t, int, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createActivationDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createActivationDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setActivationDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setActivationDescriptor, "PyObject *(size_t, int, int, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyActivationDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyActivationDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("softmaxForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_softmaxForward, "PyObject *(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("softmaxBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_softmaxBackward, "PyObject *(intptr_t, int, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("activationForward_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_activationForward_v4, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("activationBackward_v4", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_activationBackward_v4, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createDropoutDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createDropoutDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyDropoutDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyDropoutDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dropoutGetStatesSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_dropoutGetStatesSize, "Py_ssize_t (intptr_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setDropoutDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setDropoutDescriptor, "PyObject *(size_t, intptr_t, float, size_t, size_t, unsigned PY_LONG_LONG, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getDropoutReserveSpaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getDropoutReserveSpaceSize, "size_t (size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dropoutForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_dropoutForward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("dropoutBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_dropoutBackward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createCTCLossDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createCTCLossDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyCTCLossDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyCTCLossDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setCTCLossDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setCTCLossDescriptor, "PyObject *(size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getCTCLossDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getCTCLossDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getCTCLossWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getCTCLossWorkspaceSize, "size_t (intptr_t, size_t, size_t, size_t, size_t, size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("CTCLoss", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_CTCLoss, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createRNNDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createRNNDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyRNNDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createPersistentRNNPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createPersistentRNNPlan, "size_t (size_t, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setPersistentRNNPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setPersistentRNNPlan, "PyObject *(size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyPersistentRNNPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyPersistentRNNPlan, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setRNNDescriptor_v5", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v5, "PyObject *(size_t, int, int, size_t, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setRNNDescriptor_v6", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setRNNDescriptor_v6, "PyObject *(intptr_t, size_t, int, int, size_t, int, int, int, int, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setRNNPaddingMode", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setRNNPaddingMode, "PyObject *(size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNPaddingMode", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNPaddingMode, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createRNNDataDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createRNNDataDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyRNNDataDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyRNNDataDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setRNNDataDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setRNNDataDescriptor, "PyObject *(size_t, int, size_t, int, int, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNDataDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNDataDescriptor, "PyObject *(size_t, size_t, size_t, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNWorkspaceSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNWorkspaceSize, "PyObject *(intptr_t, size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNTrainingReserveSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNTrainingReserveSize, "PyObject *(intptr_t, size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNParamsSize", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNParamsSize, "PyObject *(intptr_t, size_t, size_t, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNLinLayerMatrixParams", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerMatrixParams, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getRNNLinLayerBiasParams", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getRNNLinLayerBiasParams, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, int, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNForwardInference", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInference, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNForwardTraining", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTraining, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNBackwardData", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardData, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNBackwardWeights", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeights, "PyObject *(intptr_t, size_t, int, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNForwardInferenceEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNForwardInferenceEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNForwardTrainingEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNForwardTrainingEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNBackwardDataEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardDataEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("RNNBackwardWeightsEx", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_RNNBackwardWeightsEx, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createSpatialTransformerDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createSpatialTransformerDescriptor, "size_t (int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroySpatialTransformerDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroySpatialTransformerDescriptor, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setSpatialTransformerDescriptor", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setSpatialTransformerDescriptor, "PyObject *(size_t, size_t, int, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("spatialTfGridGeneratorForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorForward, "PyObject *(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("spatialTfGridGeneratorBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_spatialTfGridGeneratorBackward, "PyObject *(intptr_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("spatialTfSamplerForward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerForward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("spatialTfSamplerBackward", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_spatialTfSamplerBackward, "PyObject *(intptr_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createFusedOpsConstParamPack", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsConstParamPack, "PyObject *(int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyFusedOpsConstParamPack", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsConstParamPack, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setFusedOpsConstParamPackAttribute", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsConstParamPackAttribute, "PyObject *(size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getFusedOpsConstParamPackAttribute", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsConstParamPackAttribute, "PyObject *(size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createFusedOpsVariantParamPack", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsVariantParamPack, "PyObject *(int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyFusedOpsVariantParamPack", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsVariantParamPack, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("setFusedOpsVariantParamPackAttribute", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_setFusedOpsVariantParamPackAttribute, "PyObject *(size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("getFusedOpsVariantParamPackAttribute", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_getFusedOpsVariantParamPackAttribute, "PyObject *(size_t, int, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("createFusedOpsPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_createFusedOpsPlan, "PyObject *(int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("destroyFusedOpsPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_destroyFusedOpsPlan, "PyObject *(size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("makeFusedOpsPlan", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_makeFusedOpsPlan, "PyObject *(intptr_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("fusedOpsExecute", (void (*)(void))__pyx_f_4cupy_4cuda_5cudnn_fusedOpsExecute, "PyObject *(intptr_t, size_t, size_t, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
  __pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf.tp_dictoffset && __pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttrString(__pyx_m, "CuDNNAlgoPerf", (PyObject *)&__pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
  __pyx_ptype_4cupy_4cuda_5cudnn_CuDNNAlgoPerf = &__pyx_type_4cupy_4cuda_5cudnn_CuDNNAlgoPerf;
  if (PyType_Ready(&__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
  __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__.tp_dictoffset && __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct____str__ = &__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct____str__;
  if (PyType_Ready(&__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
  __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr = &__pyx_type_4cupy_4cuda_5cudnn___pyx_scope_struct_1_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("cupy.cuda.stream"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "get_current_stream_ptr", (void (**)(void))&__pyx_f_4cupy_4cuda_6stream_get_current_stream_ptr, "intptr_t (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_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 PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
    #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initcudnn(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initcudnn(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_cudnn(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_cudnn(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    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__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec_cudnn(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_cudnn(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("cudnn", __pyx_methods, __pyx_k_Thin_wrapper_of_cuDNN, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_cupy__cuda__cudnn) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "cupy.cuda.cudnn")) {
      if (unlikely(PyDict_SetItemString(modules, "cupy.cuda.cudnn", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "cupy/cuda/cudnn.pyx":756
 * ###############################################################################
 * 
 * class CuDNNError(RuntimeError):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, int status):
 */
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__3, __pyx_n_s_CuDNNError, __pyx_n_s_CuDNNError, (PyObject *) NULL, __pyx_n_s_cupy_cuda_cudnn, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cupy/cuda/cudnn.pyx":758
 * class CuDNNError(RuntimeError):
 * 
 *     def __init__(self, int status):             # <<<<<<<<<<<<<<
 *         self.status = status
 *         msg = cudnnGetErrorString(<Status>status)
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_1__init__, 0, __pyx_n_s_CuDNNError___init, NULL, __pyx_n_s_cupy_cuda_cudnn, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/cuda/cudnn.pyx":765
 *         self._infos = []
 * 
 *     def add_info(self, info):             # <<<<<<<<<<<<<<
 *         assert isinstance(info, str)
 *         self._infos.append(info)
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_3add_info, 0, __pyx_n_s_CuDNNError_add_info, NULL, __pyx_n_s_cupy_cuda_cudnn, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_add_info, __pyx_t_3) < 0) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/cuda/cudnn.pyx":769
 *         self._infos.append(info)
 * 
 *     def add_infos(self, infos):             # <<<<<<<<<<<<<<
 *         assert isinstance(infos, list)
 *         self._infos.extend(infos)
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_5add_infos, 0, __pyx_n_s_CuDNNError_add_infos, NULL, __pyx_n_s_cupy_cuda_cudnn, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_add_infos, __pyx_t_3) < 0) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/cuda/cudnn.pyx":773
 *         self._infos.extend(infos)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         base = super(CuDNNError, self).__str__()
 *         return base + ''.join(
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_7__str__, 0, __pyx_n_s_CuDNNError___str, NULL, __pyx_n_s_cupy_cuda_cudnn, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_str, __pyx_t_3) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/cuda/cudnn.pyx":778
 *             '\n  ' + info for info in self._infos)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (type(self), (self.status,))
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_10CuDNNError_9__reduce__, 0, __pyx_n_s_CuDNNError___reduce, NULL, __pyx_n_s_cupy_cuda_cudnn, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_reduce, __pyx_t_3) < 0) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "cupy/cuda/cudnn.pyx":756
 * ###############################################################################
 * 
 * class CuDNNError(RuntimeError):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, int status):
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_CuDNNError, __pyx_tuple__3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CuDNNError, __pyx_t_3) < 0) __PYX_ERR(0, 756, __pyx_L1_error)
  __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;

  /* "cupy/cuda/cudnn.pyx":792
 * ###############################################################################
 * 
 * def get_build_version():             # <<<<<<<<<<<<<<
 *     return CUDNN_VERSION
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_3get_build_version, NULL, __pyx_n_s_cupy_cuda_cudnn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_build_version, __pyx_t_1) < 0) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1596
 * ###############################################################################
 * 
 * CUDNN_BN_MIN_EPSILON = _CUDNN_BN_MIN_EPSILON             # <<<<<<<<<<<<<<
 * 
 * cpdef deriveBNTensorDescriptor(
 */
  __pyx_t_1 = PyFloat_FromDouble(CUDNN_BN_MIN_EPSILON); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CUDNN_BN_MIN_EPSILON, __pyx_t_1) < 0) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_CuDNNAlgoPerf(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x8e79936:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cupy_4cuda_5cudnn_291__pyx_unpickle_CuDNNAlgoPerf, NULL, __pyx_n_s_cupy_cuda_cudnn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_CuDNNAlgoPerf, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cupy/cuda/cudnn.pyx":1
 * # distutils: language = c++             # <<<<<<<<<<<<<<
 * 
 * """Thin wrapper of cuDNN."""
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t")
 * cdef object __pyx_convert_vector_to_py_cudnnConvolutionBwdDataAlgoPerf_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /*--- Wrapped vars code ---*/
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_16BIT_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 47, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_16BIT_INDICES", wrapped) < 0) __PYX_ERR(2, 47, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_32BIT_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 45, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_32BIT_INDICES", wrapped) < 0) __PYX_ERR(2, 45, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_64BIT_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 46, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_64BIT_INDICES", wrapped) < 0) __PYX_ERR(2, 46, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_8BIT_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 48, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_8BIT_INDICES", wrapped) < 0) __PYX_ERR(2, 48, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_CLIPPED_RELU);
    if (unlikely(!wrapped)) __PYX_ERR(2, 110, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_CLIPPED_RELU", wrapped) < 0) __PYX_ERR(2, 110, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_ELU);
    if (unlikely(!wrapped)) __PYX_ERR(2, 111, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_ELU", wrapped) < 0) __PYX_ERR(2, 111, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_IDENTITY);
    if (unlikely(!wrapped)) __PYX_ERR(2, 112, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_IDENTITY", wrapped) < 0) __PYX_ERR(2, 112, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_RELU);
    if (unlikely(!wrapped)) __PYX_ERR(2, 108, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_RELU", wrapped) < 0) __PYX_ERR(2, 108, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_SIGMOID);
    if (unlikely(!wrapped)) __PYX_ERR(2, 107, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_SIGMOID", wrapped) < 0) __PYX_ERR(2, 107, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ACTIVATION_TANH);
    if (unlikely(!wrapped)) __PYX_ERR(2, 109, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ACTIVATION_TANH", wrapped) < 0) __PYX_ERR(2, 109, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_FEATURE_MAP);
    if (unlikely(!wrapped)) __PYX_ERR(2, 52, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_FEATURE_MAP", wrapped) < 0) __PYX_ERR(2, 52, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_FULL_TENSOR);
    if (unlikely(!wrapped)) __PYX_ERR(2, 55, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_FULL_TENSOR", wrapped) < 0) __PYX_ERR(2, 55, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_IMAGE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 50, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_IMAGE", wrapped) < 0) __PYX_ERR(2, 50, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_C);
    if (unlikely(!wrapped)) __PYX_ERR(2, 54, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_SAME_C", wrapped) < 0) __PYX_ERR(2, 54, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_CHW);
    if (unlikely(!wrapped)) __PYX_ERR(2, 53, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_SAME_CHW", wrapped) < 0) __PYX_ERR(2, 53, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ADD_SAME_HW);
    if (unlikely(!wrapped)) __PYX_ERR(2, 51, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ADD_SAME_HW", wrapped) < 0) __PYX_ERR(2, 51, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 125, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_OPS_BN", wrapped) < 0) __PYX_ERR(2, 125, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN_ACTIVATION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 126, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_OPS_BN_ACTIVATION", wrapped) < 0) __PYX_ERR(2, 126, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 127, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION", wrapped) < 0) __PYX_ERR(2, 127, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_PER_ACTIVATION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 118, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_PER_ACTIVATION", wrapped) < 0) __PYX_ERR(2, 118, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_SPATIAL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 119, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_SPATIAL", wrapped) < 0) __PYX_ERR(2, 119, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BATCHNORM_SPATIAL_PERSISTENT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 120, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BATCHNORM_SPATIAL_PERSISTENT", wrapped) < 0) __PYX_ERR(2, 120, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_BIDIRECTIONAL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 135, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_BIDIRECTIONAL", wrapped) < 0) __PYX_ERR(2, 135, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 57, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION", wrapped) < 0) __PYX_ERR(2, 57, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_0);
    if (unlikely(!wrapped)) __PYX_ERR(2, 88, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_0", wrapped) < 0) __PYX_ERR(2, 88, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_1);
    if (unlikely(!wrapped)) __PYX_ERR(2, 89, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_1", wrapped) < 0) __PYX_ERR(2, 89, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 90, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT", wrapped) < 0) __PYX_ERR(2, 90, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 91, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING", wrapped) < 0) __PYX_ERR(2, 91, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 92, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD", wrapped) < 0) __PYX_ERR(2, 92, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 93, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED", wrapped) < 0) __PYX_ERR(2, 93, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 84, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE", wrapped) < 0) __PYX_ERR(2, 84, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST);
    if (unlikely(!wrapped)) __PYX_ERR(2, 85, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST", wrapped) < 0) __PYX_ERR(2, 85, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 86, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT", wrapped) < 0) __PYX_ERR(2, 86, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0);
    if (unlikely(!wrapped)) __PYX_ERR(2, 77, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0", wrapped) < 0) __PYX_ERR(2, 77, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1);
    if (unlikely(!wrapped)) __PYX_ERR(2, 78, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1", wrapped) < 0) __PYX_ERR(2, 78, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3);
    if (unlikely(!wrapped)) __PYX_ERR(2, 80, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3", wrapped) < 0) __PYX_ERR(2, 80, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 79, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT", wrapped) < 0) __PYX_ERR(2, 79, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 81, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD", wrapped) < 0) __PYX_ERR(2, 81, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 82, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED", wrapped) < 0) __PYX_ERR(2, 82, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 73, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE", wrapped) < 0) __PYX_ERR(2, 73, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST);
    if (unlikely(!wrapped)) __PYX_ERR(2, 74, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST", wrapped) < 0) __PYX_ERR(2, 74, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 75, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT", wrapped) < 0) __PYX_ERR(2, 75, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_DIRECT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 67, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_DIRECT", wrapped) < 0) __PYX_ERR(2, 67, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_FFT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 68, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_FFT", wrapped) < 0) __PYX_ERR(2, 68, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 69, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", wrapped) < 0) __PYX_ERR(2, 69, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_GEMM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 66, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_GEMM", wrapped) < 0) __PYX_ERR(2, 66, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 64, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", wrapped) < 0) __PYX_ERR(2, 64, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 65, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", wrapped) < 0) __PYX_ERR(2, 65, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 70, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", wrapped) < 0) __PYX_ERR(2, 70, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 71, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", wrapped) < 0) __PYX_ERR(2, 71, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_NO_WORKSPACE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 60, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_NO_WORKSPACE", wrapped) < 0) __PYX_ERR(2, 60, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_PREFER_FASTEST);
    if (unlikely(!wrapped)) __PYX_ERR(2, 61, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_PREFER_FASTEST", wrapped) < 0) __PYX_ERR(2, 61, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 62, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT", wrapped) < 0) __PYX_ERR(2, 62, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CROSS_CORRELATION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 58, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CROSS_CORRELATION", wrapped) < 0) __PYX_ERR(2, 58, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CTC_LOSS_ALGO_DETERMINISTIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 122, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CTC_LOSS_ALGO_DETERMINISTIC", wrapped) < 0) __PYX_ERR(2, 122, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 123, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC", wrapped) < 0) __PYX_ERR(2, 123, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_DOUBLE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 10, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DATA_DOUBLE", wrapped) < 0) __PYX_ERR(2, 10, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_FLOAT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 9, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DATA_FLOAT", wrapped) < 0) __PYX_ERR(2, 9, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DATA_HALF);
    if (unlikely(!wrapped)) __PYX_ERR(2, 11, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DATA_HALF", wrapped) < 0) __PYX_ERR(2, 11, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DEFAULT_MATH);
    if (unlikely(!wrapped)) __PYX_ERR(2, 13, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DEFAULT_MATH", wrapped) < 0) __PYX_ERR(2, 13, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DETERMINISTIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 20, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DETERMINISTIC", wrapped) < 0) __PYX_ERR(2, 20, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_DIVNORM_PRECOMPUTED_MEANS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 116, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_DIVNORM_PRECOMPUTED_MEANS", wrapped) < 0) __PYX_ERR(2, 116, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_BLOCKING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 160, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ERRQUERY_BLOCKING", wrapped) < 0) __PYX_ERR(2, 160, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_NONBLOCKING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 159, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ERRQUERY_NONBLOCKING", wrapped) < 0) __PYX_ERR(2, 159, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_ERRQUERY_RAWCODE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 158, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_ERRQUERY_RAWCODE", wrapped) < 0) __PYX_ERR(2, 158, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 166, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE", wrapped) < 0) __PYX_ERR(2, 166, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 165, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING", wrapped) < 0) __PYX_ERR(2, 165, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION);
    if (unlikely(!wrapped)) __PYX_ERR(2, 167, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION", wrapped) < 0) __PYX_ERR(2, 167, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 169, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM", wrapped) < 0) __PYX_ERR(2, 169, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 163, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS", wrapped) < 0) __PYX_ERR(2, 163, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 164, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD", wrapped) < 0) __PYX_ERR(2, 164, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK);
    if (unlikely(!wrapped)) __PYX_ERR(2, 168, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK", wrapped) < 0) __PYX_ERR(2, 168, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_GRU);
    if (unlikely(!wrapped)) __PYX_ERR(2, 132, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_GRU", wrapped) < 0) __PYX_ERR(2, 132, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_LINEAR_INPUT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 148, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_LINEAR_INPUT", wrapped) < 0) __PYX_ERR(2, 148, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_LRN_CROSS_CHANNEL_DIM1);
    if (unlikely(!wrapped)) __PYX_ERR(2, 114, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_LRN_CROSS_CHANNEL_DIM1", wrapped) < 0) __PYX_ERR(2, 114, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_LSTM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 131, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_LSTM", wrapped) < 0) __PYX_ERR(2, 131, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_NON_DETERMINISTIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 19, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_NON_DETERMINISTIC", wrapped) < 0) __PYX_ERR(2, 19, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_NOT_PROPAGATE_NAN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 16, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_NOT_PROPAGATE_NAN", wrapped) < 0) __PYX_ERR(2, 16, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_ADD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 25, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_ADD", wrapped) < 0) __PYX_ERR(2, 25, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MAX);
    if (unlikely(!wrapped)) __PYX_ERR(2, 28, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_MAX", wrapped) < 0) __PYX_ERR(2, 28, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MIN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 27, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_MIN", wrapped) < 0) __PYX_ERR(2, 27, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_MUL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 26, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_MUL", wrapped) < 0) __PYX_ERR(2, 26, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_NOT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 30, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_NOT", wrapped) < 0) __PYX_ERR(2, 30, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_OP_TENSOR_SQRT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 29, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_OP_TENSOR_SQRT", wrapped) < 0) __PYX_ERR(2, 29, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_BITMASK_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 203, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_ACTIVATION_BITMASK_DESC", wrapped) < 0) __PYX_ERR(2, 203, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 204, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 204, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ACTIVATION_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 178, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_ACTIVATION_DESC", wrapped) < 0) __PYX_ERR(2, 178, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_BIAS_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 193, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_BIAS_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 193, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_DBIAS_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 210, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_DBIAS_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 210, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_DSCALE_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 209, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_DSCALE_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 209, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 177, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 177, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQSCALEBIAS_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 175, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_EQSCALEBIAS_DESC", wrapped) < 0) __PYX_ERR(2, 175, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 176, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 176, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_MODE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 174, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_MODE", wrapped) < 0) __PYX_ERR(2, 174, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 196, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 196, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 197, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 197, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 195, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 195, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 194, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 194, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 191, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC", wrapped) < 0) __PYX_ERR(2, 191, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_SCALE_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 192, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_SCALE_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 192, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 202, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 202, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 200, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC", wrapped) < 0) __PYX_ERR(2, 200, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 201, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 201, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_CONV_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 179, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_CONV_DESC", wrapped) < 0) __PYX_ERR(2, 179, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DWDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 183, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DWDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 183, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DWDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 182, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DWDESC", wrapped) < 0) __PYX_ERR(2, 182, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DXDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 206, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DXDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 206, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DXDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 205, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DXDESC", wrapped) < 0) __PYX_ERR(2, 205, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DYDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 187, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DYDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 187, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DYDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 186, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DYDESC", wrapped) < 0) __PYX_ERR(2, 186, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DZDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 208, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DZDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 208, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_DZDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 207, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_DZDESC", wrapped) < 0) __PYX_ERR(2, 207, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_WDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 181, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_WDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 181, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_WDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 180, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_WDESC", wrapped) < 0) __PYX_ERR(2, 180, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_XDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 173, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_XDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 173, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_XDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 172, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_XDESC", wrapped) < 0) __PYX_ERR(2, 172, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 185, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_YDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 185, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 184, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_YDESC", wrapped) < 0) __PYX_ERR(2, 184, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSQSUM_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 190, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_YSQSUM_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 190, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSTATS_DESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 188, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_YSTATS_DESC", wrapped) < 0) __PYX_ERR(2, 188, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_YSUM_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 189, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_YSUM_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 189, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ZDATA_PLACEHOLDER);
    if (unlikely(!wrapped)) __PYX_ERR(2, 199, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_ZDATA_PLACEHOLDER", wrapped) < 0) __PYX_ERR(2, 199, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PARAM_ZDESC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 198, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PARAM_ZDESC", wrapped) < 0) __PYX_ERR(2, 198, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 104, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING", wrapped) < 0) __PYX_ERR(2, 104, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 103, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING", wrapped) < 0) __PYX_ERR(2, 103, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_MAX);
    if (unlikely(!wrapped)) __PYX_ERR(2, 102, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_POOLING_MAX", wrapped) < 0) __PYX_ERR(2, 102, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_POOLING_MAX_DETERMINISTIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 105, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_POOLING_MAX_DETERMINISTIC", wrapped) < 0) __PYX_ERR(2, 105, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PROPAGATE_NAN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 17, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PROPAGATE_NAN", wrapped) < 0) __PYX_ERR(2, 17, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_16B_ALIGNED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 215, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_16B_ALIGNED", wrapped) < 0) __PYX_ERR(2, 215, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ACTIVATION_BITMASK);
    if (unlikely(!wrapped)) __PYX_ERR(2, 237, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_ACTIVATION_BITMASK", wrapped) < 0) __PYX_ERR(2, 237, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_BIAS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 229, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_BIAS", wrapped) < 0) __PYX_ERR(2, 229, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_DBIAS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 241, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_DBIAS", wrapped) < 0) __PYX_ERR(2, 241, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_DSCALE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 240, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_DSCALE", wrapped) < 0) __PYX_ERR(2, 240, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_EQBIAS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 220, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_EQBIAS", wrapped) < 0) __PYX_ERR(2, 220, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_EQSCALE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 219, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_EQSCALE", wrapped) < 0) __PYX_ERR(2, 219, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_RUNNING_MEAN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 232, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_RUNNING_MEAN", wrapped) < 0) __PYX_ERR(2, 232, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_RUNNING_VAR);
    if (unlikely(!wrapped)) __PYX_ERR(2, 233, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_RUNNING_VAR", wrapped) < 0) __PYX_ERR(2, 233, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SAVED_INVSTD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 231, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_SAVED_INVSTD", wrapped) < 0) __PYX_ERR(2, 231, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SAVED_MEAN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 230, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_SAVED_MEAN", wrapped) < 0) __PYX_ERR(2, 230, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_SCALE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 228, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_SCALE", wrapped) < 0) __PYX_ERR(2, 228, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_Z_EQBIAS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 236, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_Z_EQBIAS", wrapped) < 0) __PYX_ERR(2, 236, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_BN_Z_EQSCALE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 235, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_BN_Z_EQSCALE", wrapped) < 0) __PYX_ERR(2, 235, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DWDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 222, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_DWDATA", wrapped) < 0) __PYX_ERR(2, 222, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DXDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 238, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_DXDATA", wrapped) < 0) __PYX_ERR(2, 238, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DYDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 224, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_DYDATA", wrapped) < 0) __PYX_ERR(2, 224, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_DZDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 239, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_DZDATA", wrapped) < 0) __PYX_ERR(2, 239, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ELEM_ALIGNED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 214, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_ELEM_ALIGNED", wrapped) < 0) __PYX_ERR(2, 214, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_NULL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 213, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_NULL", wrapped) < 0) __PYX_ERR(2, 213, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_WDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 221, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_WDATA", wrapped) < 0) __PYX_ERR(2, 221, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_WORKSPACE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 227, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_WORKSPACE", wrapped) < 0) __PYX_ERR(2, 227, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_XDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 218, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_XDATA", wrapped) < 0) __PYX_ERR(2, 218, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 223, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_YDATA", wrapped) < 0) __PYX_ERR(2, 223, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YSQSUM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 226, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_YSQSUM", wrapped) < 0) __PYX_ERR(2, 226, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_YSUM);
    if (unlikely(!wrapped)) __PYX_ERR(2, 225, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_YSUM", wrapped) < 0) __PYX_ERR(2, 225, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_PTR_ZDATA);
    if (unlikely(!wrapped)) __PYX_ERR(2, 234, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_PTR_ZDATA", wrapped) < 0) __PYX_ERR(2, 234, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_ADD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 32, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_ADD", wrapped) < 0) __PYX_ERR(2, 32, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_AMAX);
    if (unlikely(!wrapped)) __PYX_ERR(2, 36, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_AMAX", wrapped) < 0) __PYX_ERR(2, 36, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_AVG);
    if (unlikely(!wrapped)) __PYX_ERR(2, 37, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_AVG", wrapped) < 0) __PYX_ERR(2, 37, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_FLATTENED_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 43, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_FLATTENED_INDICES", wrapped) < 0) __PYX_ERR(2, 43, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MAX);
    if (unlikely(!wrapped)) __PYX_ERR(2, 35, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_MAX", wrapped) < 0) __PYX_ERR(2, 35, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MIN);
    if (unlikely(!wrapped)) __PYX_ERR(2, 34, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_MIN", wrapped) < 0) __PYX_ERR(2, 34, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MUL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 33, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_MUL", wrapped) < 0) __PYX_ERR(2, 33, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 40, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS", wrapped) < 0) __PYX_ERR(2, 40, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NORM1);
    if (unlikely(!wrapped)) __PYX_ERR(2, 38, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_NORM1", wrapped) < 0) __PYX_ERR(2, 38, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NORM2);
    if (unlikely(!wrapped)) __PYX_ERR(2, 39, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_NORM2", wrapped) < 0) __PYX_ERR(2, 39, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_REDUCE_TENSOR_NO_INDICES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 42, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_REDUCE_TENSOR_NO_INDICES", wrapped) < 0) __PYX_ERR(2, 42, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_PERSIST_DYNAMIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 139, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_ALGO_PERSIST_DYNAMIC", wrapped) < 0) __PYX_ERR(2, 139, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_PERSIST_STATIC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 138, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_ALGO_PERSIST_STATIC", wrapped) < 0) __PYX_ERR(2, 138, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_ALGO_STANDARD);
    if (unlikely(!wrapped)) __PYX_ERR(2, 137, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_ALGO_STANDARD", wrapped) < 0) __PYX_ERR(2, 137, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 143, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED", wrapped) < 0) __PYX_ERR(2, 143, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 142, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED", wrapped) < 0) __PYX_ERR(2, 142, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 141, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED", wrapped) < 0) __PYX_ERR(2, 141, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_PADDED_IO_DISABLED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 145, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_PADDED_IO_DISABLED", wrapped) < 0) __PYX_ERR(2, 145, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_PADDED_IO_ENABLED);
    if (unlikely(!wrapped)) __PYX_ERR(2, 146, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_PADDED_IO_ENABLED", wrapped) < 0) __PYX_ERR(2, 146, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_RELU);
    if (unlikely(!wrapped)) __PYX_ERR(2, 129, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_RELU", wrapped) < 0) __PYX_ERR(2, 129, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_RNN_TANH);
    if (unlikely(!wrapped)) __PYX_ERR(2, 130, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_RNN_TANH", wrapped) < 0) __PYX_ERR(2, 130, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SAMPLER_BILINEAR);
    if (unlikely(!wrapped)) __PYX_ERR(2, 151, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SAMPLER_BILINEAR", wrapped) < 0) __PYX_ERR(2, 151, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_DOUBLE_BN_EPSILON);
    if (unlikely(!wrapped)) __PYX_ERR(2, 245, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SCALAR_DOUBLE_BN_EPSILON", wrapped) < 0) __PYX_ERR(2, 245, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR);
    if (unlikely(!wrapped)) __PYX_ERR(2, 244, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR", wrapped) < 0) __PYX_ERR(2, 244, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 243, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT", wrapped) < 0) __PYX_ERR(2, 243, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES);
    if (unlikely(!wrapped)) __PYX_ERR(2, 242, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES", wrapped) < 0) __PYX_ERR(2, 242, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SKIP_INPUT);
    if (unlikely(!wrapped)) __PYX_ERR(2, 149, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SKIP_INPUT", wrapped) < 0) __PYX_ERR(2, 149, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_ACCURATE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 96, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SOFTMAX_ACCURATE", wrapped) < 0) __PYX_ERR(2, 96, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_FAST);
    if (unlikely(!wrapped)) __PYX_ERR(2, 95, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SOFTMAX_FAST", wrapped) < 0) __PYX_ERR(2, 95, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_LOG);
    if (unlikely(!wrapped)) __PYX_ERR(2, 97, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SOFTMAX_LOG", wrapped) < 0) __PYX_ERR(2, 97, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_MODE_CHANNEL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 100, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SOFTMAX_MODE_CHANNEL", wrapped) < 0) __PYX_ERR(2, 100, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_SOFTMAX_MODE_INSTANCE);
    if (unlikely(!wrapped)) __PYX_ERR(2, 99, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_SOFTMAX_MODE_INSTANCE", wrapped) < 0) __PYX_ERR(2, 99, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_FP_OVERFLOW);
    if (unlikely(!wrapped)) __PYX_ERR(2, 156, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_STATUS_RUNTIME_FP_OVERFLOW", wrapped) < 0) __PYX_ERR(2, 156, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_IN_PROGRESS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 155, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_STATUS_RUNTIME_IN_PROGRESS", wrapped) < 0) __PYX_ERR(2, 155, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING);
    if (unlikely(!wrapped)) __PYX_ERR(2, 154, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING", wrapped) < 0) __PYX_ERR(2, 154, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_STATUS_SUCCESS);
    if (unlikely(!wrapped)) __PYX_ERR(2, 153, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_STATUS_SUCCESS", wrapped) < 0) __PYX_ERR(2, 153, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_NCHW);
    if (unlikely(!wrapped)) __PYX_ERR(2, 22, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_TENSOR_NCHW", wrapped) < 0) __PYX_ERR(2, 22, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_NHWC);
    if (unlikely(!wrapped)) __PYX_ERR(2, 23, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_TENSOR_NHWC", wrapped) < 0) __PYX_ERR(2, 23, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_TENSOR_OP_MATH);
    if (unlikely(!wrapped)) __PYX_ERR(2, 14, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_TENSOR_OP_MATH", wrapped) < 0) __PYX_ERR(2, 14, __pyx_L1_error);
  }
  {
    PyObject* wrapped = __Pyx_PyInt_From_int(__pyx_e_4cupy_4cuda_5cudnn_CUDNN_UNIDIRECTIONAL);
    if (unlikely(!wrapped)) __PYX_ERR(2, 134, __pyx_L1_error)
    if (PyObject_SetAttrString(__pyx_m, "CUDNN_UNIDIRECTIONAL", wrapped) < 0) __PYX_ERR(2, 134, __pyx_L1_error);
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init cupy.cuda.cudnn", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cupy.cuda.cudnn");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- 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((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#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);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* 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);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    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;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyErrExceptionMatches */
#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);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    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) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    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);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *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

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
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;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    if (likely(result)) {
        Py_INCREF(result);
    } else if (unlikely(PyErr_Occurred())) {
        result = NULL;
    } else {
#else
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* PyObjectSetAttrStr */
    #if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyObjectCall */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" 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

/* decode_c_string */
    static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyCFunctionFastCall */
    #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
    #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCallMethO */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" 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

/* PyObjectCallOneArg */
    #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallMethod1 */
    static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = NULL;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
    goto done;
done:
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) return NULL;
    result = __Pyx__PyObject_CallMethod1(method, arg);
    Py_DECREF(method);
    return result;
}

/* 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_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* None */
    static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* PyObjectCallNoArg */
    #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* RaiseException */
      #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
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 CYTHON_COMPILING_IN_PYPY
        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);
#else
        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);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* Import */
      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
      static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* GetItemInt */
      static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if 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((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* HasAttr */
      static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* PyObject_GenericGetAttrNoDict */
      #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
      #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetupReduce */
      static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  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_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* CalculateMetaclass */
      static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* FetchCommonType */
      static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
      #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* Py3ClassCreate */
          static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
          #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (PyObject_Not(use_cline) != 0) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
          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 PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_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(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
          #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    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;
    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) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __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);
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* 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;\
    }

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnStatus_t(cudnnStatus_t value) {
    const cudnnStatus_t neg_one = (cudnnStatus_t) -1, const_zero = (cudnnStatus_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnStatus_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnStatus_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnStatus_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnStatus_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnStatus_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnStatus_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnDataType_t(cudnnDataType_t value) {
    const cudnnDataType_t neg_one = (cudnnDataType_t) -1, const_zero = (cudnnDataType_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnDataType_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnDataType_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnDataType_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnDataType_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnDataType_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnDataType_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnOpTensorOp_t(cudnnOpTensorOp_t value) {
    const cudnnOpTensorOp_t neg_one = (cudnnOpTensorOp_t) -1, const_zero = (cudnnOpTensorOp_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnOpTensorOp_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnOpTensorOp_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnOpTensorOp_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnOpTensorOp_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnOpTensorOp_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnOpTensorOp_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnNanPropagation_t(cudnnNanPropagation_t value) {
    const cudnnNanPropagation_t neg_one = (cudnnNanPropagation_t) -1, const_zero = (cudnnNanPropagation_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnNanPropagation_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnNanPropagation_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnNanPropagation_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnNanPropagation_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnNanPropagation_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnNanPropagation_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnReduceTensorOp_t(cudnnReduceTensorOp_t value) {
    const cudnnReduceTensorOp_t neg_one = (cudnnReduceTensorOp_t) -1, const_zero = (cudnnReduceTensorOp_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnReduceTensorOp_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnReduceTensorOp_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnReduceTensorOp_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnReduceTensorOp_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnReduceTensorOp_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnReduceTensorOp_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnReduceTensorIndices_t(cudnnReduceTensorIndices_t value) {
    const cudnnReduceTensorIndices_t neg_one = (cudnnReduceTensorIndices_t) -1, const_zero = (cudnnReduceTensorIndices_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnReduceTensorIndices_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnReduceTensorIndices_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnReduceTensorIndices_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnReduceTensorIndices_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnReduceTensorIndices_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnReduceTensorIndices_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnIndicesType_t(cudnnIndicesType_t value) {
    const cudnnIndicesType_t neg_one = (cudnnIndicesType_t) -1, const_zero = (cudnnIndicesType_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnIndicesType_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnIndicesType_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnIndicesType_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnIndicesType_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnIndicesType_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnIndicesType_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnTensorFormat_t(cudnnTensorFormat_t value) {
    const cudnnTensorFormat_t neg_one = (cudnnTensorFormat_t) -1, const_zero = (cudnnTensorFormat_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnTensorFormat_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnTensorFormat_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnTensorFormat_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnTensorFormat_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnTensorFormat_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnTensorFormat_t),
                                     little, !is_unsigned);
    }
}

static PyObject* __pyx_convert__to_py_cudnnConvolutionFwdAlgoPerf_t(cudnnConvolutionFwdAlgoPerf_t s) {
            PyObject* res;
            PyObject* member;
            res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL;
            member = __Pyx_PyInt_From_int(s.algo); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_algo, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_From_int(s.status); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_status, member) < 0)) goto bad;
            Py_DECREF(member);
            member = PyFloat_FromDouble(s.time); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_time, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_FromSize_t(s.memory); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_memory, member) < 0)) goto bad;
            Py_DECREF(member);
            return res;
            bad:
            Py_XDECREF(member);
            Py_DECREF(res);
            return NULL;
          }
          static PyObject* __pyx_convert__to_py_cudnnConvolutionBwdFilterAlgoPerf_t(cudnnConvolutionBwdFilterAlgoPerf_t s) {
            PyObject* res;
            PyObject* member;
            res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL;
            member = __Pyx_PyInt_From_int(s.algo); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_algo, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_From_int(s.status); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_status, member) < 0)) goto bad;
            Py_DECREF(member);
            member = PyFloat_FromDouble(s.time); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_time, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_FromSize_t(s.memory); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_memory, member) < 0)) goto bad;
            Py_DECREF(member);
            return res;
            bad:
            Py_XDECREF(member);
            Py_DECREF(res);
            return NULL;
          }
          static PyObject* __pyx_convert__to_py_cudnnConvolutionBwdDataAlgoPerf_t(cudnnConvolutionBwdDataAlgoPerf_t s) {
            PyObject* res;
            PyObject* member;
            res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL;
            member = __Pyx_PyInt_From_int(s.algo); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_algo, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_From_int(s.status); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_status, member) < 0)) goto bad;
            Py_DECREF(member);
            member = PyFloat_FromDouble(s.time); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_time, member) < 0)) goto bad;
            Py_DECREF(member);
            member = __Pyx_PyInt_FromSize_t(s.memory); if (unlikely(!member)) goto bad;
            if (unlikely(PyDict_SetItem(res, __pyx_n_s_memory, member) < 0)) goto bad;
            Py_DECREF(member);
            return res;
            bad:
            Py_XDECREF(member);
            Py_DECREF(res);
            return NULL;
          }
          /* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_cudnnRNNPaddingMode_t(cudnnRNNPaddingMode_t value) {
    const cudnnRNNPaddingMode_t neg_one = (cudnnRNNPaddingMode_t) -1, const_zero = (cudnnRNNPaddingMode_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(cudnnRNNPaddingMode_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(cudnnRNNPaddingMode_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnRNNPaddingMode_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(cudnnRNNPaddingMode_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(cudnnRNNPaddingMode_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(cudnnRNNPaddingMode_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
          static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } 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 PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
          static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                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
            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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        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 size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                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
            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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        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;
}

/* CIntFromPy */
          static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned PY_LONG_LONG) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned PY_LONG_LONG) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
                            return (unsigned PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
                            return (unsigned 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]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_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(unsigned PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
                            return (unsigned 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]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            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 (unsigned PY_LONG_LONG) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned PY_LONG_LONG) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned PY_LONG_LONG) ((((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned 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])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_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(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((((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])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_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(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned 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])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned PY_LONG_LONG val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned PY_LONG_LONG) -1;
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned PY_LONG_LONG) -1;
        val = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned PY_LONG_LONG");
    return (unsigned PY_LONG_LONG) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned PY_LONG_LONG");
    return (unsigned PY_LONG_LONG) -1;
}

/* CIntFromPy */
          static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                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
            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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                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))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        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;
}

/* FastTypeChecks */
          #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        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);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *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

/* SaveResetException */
          #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if PY_VERSION_HEX >= 0x030700A2
    *type = tstate->exc_state.exc_type;
    *value = tstate->exc_state.exc_value;
    *tb = tstate->exc_state.exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = type;
    tstate->exc_state.exc_value = value;
    tstate->exc_state.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

/* SwapException */
          #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 PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = *type;
    tstate->exc_state.exc_value = *value;
    tstate->exc_state.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

/* CoroutineBase */
          #include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __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;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#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 PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    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);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if (0) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int 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(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    if (self->exc_type) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
        __Pyx_ExceptionSave(&self->exc_type, &self->exc_value, &self->exc_traceback);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__pyx_CoroutineObject *self) {
    if (likely(self->exc_traceback)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #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 && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    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);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        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)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
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 = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        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)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        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_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
#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_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 (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 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);
    PyObject_GC_Del(gen);
}
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;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __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 PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
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->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    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;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
              static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
              #ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
              static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
              static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* FunctionExport */
              static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* ModuleImport */
              #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* FunctionImport */
              #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
              static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
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_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#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_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        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 PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  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 PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      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 = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
